c++,0ms,no memo,no pow/sqrt


  • 0
    F

    class Solution {
    public:
    int climbStairs(int n) {
    if(n==1)
    return 1;
    if(n==2)
    return 2;
    if(n==3)
    return 3;
    return climbStairs(n/2)*climbStairs(n-n/2)+climbStairs(n/2-1)*climbStairs(n-n/2-1);

    }
    

    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.