| Conditions | 5 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public static function uniquePaths(int $m, int $n): int |
||
| 10 | { |
||
| 11 | if ($m <= 0 || $n <= 0) { |
||
| 12 | return 0; |
||
| 13 | } |
||
| 14 | $dp = array_fill(0, $m, array_fill(0, $n, 1)); |
||
| 15 | for ($i = 1; $i < $m; $i++) { |
||
| 16 | for ($j = 1; $j < $n; $j++) { |
||
| 17 | $dp[$i][$j] = $dp[$i - 1][$j] + $dp[$i][$j - 1]; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | return $dp[$m - 1][$n - 1]; |
||
| 22 | } |
||
| 57 |