:type m: int :type n: int :rtype: int
(self, m, n)
| 52 | |
| 53 | class Solution(object): |
| 54 | def uniquePaths(self, m, n): |
| 55 | """ |
| 56 | :type m: int |
| 57 | :type n: int |
| 58 | :rtype: int |
| 59 | """ |
| 60 | |
| 61 | _map = [[0 for _ in range(m)] for _ in range(n)] |
| 62 | # _map[0][0] = 1 |
| 63 | |
| 64 | for i in range(n): |
| 65 | for j in range(m): |
| 66 | x = _map[i-1][j] if i - 1 >= 0 else 0 |
| 67 | y = _map[i][j-1] if j - 1 >= 0 else 0 |
| 68 | |
| 69 | if x + y == 0: |
| 70 | _map[i][j] = 1 |
| 71 | else: |
| 72 | _map[i][j] = x + y |
| 73 | |
| 74 | return _map[n-1][m-1] |
| 75 |
nothing calls this directly
no outgoing calls
no test coverage detected