File tree 2 files changed +10
-1
lines changed
algorithms/climbingStairs
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 353
353
| 73| [ Set Matrix Zeroes] ( https://leetcode.com/problems/set-matrix-zeroes/ ) | | Medium|
354
354
| 72| [ Edit Distance] ( https://leetcode.com/problems/edit-distance/ ) | | Hard|
355
355
| 71| [ Simplify Path] ( https://leetcode.com/problems/simplify-path/ ) | | Medium|
356
- | 70| [ Climbing Stairs] ( https://leetcode.com/problems/climbing-stairs/ ) | | Easy|
356
+ | 70| [ Climbing Stairs] ( https://leetcode.com/problems/climbing-stairs/ ) | [ js ] ( ./algorithms/climbingStairs/climbingStairs.js ) , | Easy|
357
357
| 69| [ Sqrt(x)] ( https://leetcode.com/problems/sqrtx/ ) | | Medium|
358
358
| 68| [ Text Justification] ( https://leetcode.com/problems/text-justification/ ) | | Hard|
359
359
| 67| [ Add Binary] ( https://leetcode.com/problems/add-binary/ ) | | Easy|
Original file line number Diff line number Diff line change
1
+ var climbStairs = function ( n ) {
2
+ let p = 0 , q = 0 , r = 1 ;
3
+ for ( let i = 1 ; i <= n ; i ++ ) {
4
+ p = q ;
5
+ q = r ;
6
+ r = p + q ;
7
+ }
8
+ return r ;
9
+ } ;
You can’t perform that action at this time.
0 commit comments