diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" index 8f8bc9a649..5dde64098d 100644 --- "a/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" +++ "b/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" @@ -225,8 +225,25 @@ function climbStairs(n: number): number { }; ``` +Rust: - +```rust +impl Solution { + pub fn climb_stairs(n: i32) -> i32 { + let (n, m) = (n as usize, 2); + let mut dp = vec![0; n + 1]; + dp[0] = 1; + for i in 1..=n { + for j in 1..=m { + if i >= j { + dp[i] += dp[i - j]; + } + } + } + dp[n] + } +} +```