MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / unique_paths

Method unique_paths

62. Unique Paths/src/main.rs:8–16  ·  view source on GitHub ↗
(m: i32, n: i32)

Source from the content-addressed store, hash-verified

6
7impl Solution {
8 pub fn unique_paths(m: i32, n: i32) -> i32 {
9 let mut vec = vec![1; n as usize];
10 for _ in 0..m as usize - 1 {
11 for i in 1..n as usize {
12 vec[i] = vec[i] + vec[i-1];
13 }
14 }
15 vec[n as usize - 1]
16 }
17}
18
19#[cfg(test)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected