题解 | #不同路径的数目(一)# | Rust
不同路径的数目(一)
https://www.nowcoder.com/practice/166eaff8439d4cd898e3ba933fbc6358
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param m int整型 * @param n int整型 * @return int整型 */ pub fn uniquePaths(&self, m: i32, n: i32) -> i32 { let mut dp = vec![vec![1 as i32; n as usize]; m as usize]; for i in 1..m as usize{ for j in 1..n as usize{ dp[i][j] = dp[i-1][j] + dp[i][j-1]; } } return dp[m as usize -1][n as usize -1]; } }#rust##Rust#