One line java solution


  • 0
    M
    public class Solution {
        public int climbStairs(int n) {
            return (int)(1./Math.sqrt(5)*(Math.pow((1+Math.sqrt(5))/2, n+1)-Math.pow((1-Math.sqrt(5))/2, n+1)));
        }
    }

Log in to reply
 

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