Skip to content

Commit

Permalink
63: Re-submit
Browse files Browse the repository at this point in the history
  • Loading branch information
sankichi92 committed Dec 30, 2023
1 parent d2cb1ee commit adc5129
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 63-unique-paths/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ pub fn unique_paths(m: i32, n: i32) -> i32 {
for i in 0..m {
for j in 0..n {
grid[i][j] = match (i, j) {
(0, 0) => 0,
(0, _) => 1,
(_, 0) => 1,
_ => grid[i - 1][j] + grid[i][j - 1]
_ => grid[i - 1][j] + grid[i][j - 1],
}
}
}
Expand All @@ -29,4 +28,9 @@ mod tests {
fn case2() {
assert_eq!(unique_paths(3, 2), 3);
}

#[test]
fn failed_case1() {
assert_eq!(unique_paths(1, 1), 1);
}
}

0 comments on commit adc5129

Please sign in to comment.