Skip to content

Commit 82bdead

Browse files
committed
solve problem
1 parent bcd0e26 commit 82bdead

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

unique-paths/delight010.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
func uniquePaths(_ m: Int, _ n: Int) -> Int {
3+
let column = Array(repeating: 1, count: n)
4+
var grid: [[Int]] = Array(repeating: column, count: m)
5+
for i in 1..<m {
6+
for j in 1..<n {
7+
grid[i][j] = grid[i - 1][j] + grid[i][j - 1]
8+
}
9+
}
10+
return grid.last!.last!
11+
}
12+
}
13+

0 commit comments

Comments
 (0)