My LeetCode grinding. Trying to do a problem a day.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617
  1. pub fn climb_stairs(n: i32) -> i32 {
  2. let mut v = Vec::<i32>::new();
  3. v.push(0);
  4. v.push(1);
  5. v.push(2);
  6. let mut i = 3;
  7. while i <= n {
  8. v.push(v[((i - 2) as usize)] + v[((i - 1) as usize)]);
  9. i += 1;
  10. }
  11. return v[(n as usize)];
  12. }
  13. pub fn main() {
  14. println!("Expected: 1836311903");
  15. println!("Got: {}", climb_stairs(45));
  16. }