We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7943b68 commit 87728b6Copy full SHA for 87728b6
scripts/algorithms/U/Unique Paths/Unique Paths.rs
@@ -0,0 +1,11 @@
1
+// Runtime: 2 ms (Top 20.53%) | Memory: 2.00 MB (Top 53.64%)
2
+
3
+impl Solution {
4
+ pub fn unique_paths(m: i32, n: i32) -> i32 {
5
+ let mut ans: i64 = 1;
6
+ for i in 1..=m as i64 - 1 {
7
+ ans = ans * (n as i64 - 1 + i) / i;
8
+ }
9
+ ans as i32
10
11
+}
0 commit comments