merge: add test case and description (#842)

This commit is contained in:
YATIN KATHURIA
2021-11-22 22:23:48 +05:30
committed by GitHub
parent 02a4cee5c2
commit 4e7a15694b
2 changed files with 26 additions and 4 deletions

View File

@ -1,7 +1,10 @@
/*
* You are climbing a stair case. It takes n steps to reach to the top.
* Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
*/
/**
* @function ClimbStairs
* @description You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
* @param {Integer} n - The input integer
* @return {Integer} distinct ways can you climb to the top.
* @see [Climb_Stairs](https://www.geeksforgeeks.org/count-ways-reach-nth-stair/)
*/
const climbStairs = (n) => {
let prev = 0