2 lines C# code


  • 0
    H
    public class Solution {
        public int ClimbStairs(int n) {
            if (n<=0) return 0;
            return Convert.ToInt32((Math.Pow((Math.Sqrt(5) + 1) / 2, n+1) - Math.Pow((1-Math.Sqrt(5)) / 2, n+1))/Math.Sqrt(5));
        }
    }

Log in to reply
 

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