(int n)
| 10 | */ |
| 11 | public class Solution { |
| 12 | public int climbStairs(int n) { |
| 13 | int a = 1, b = 1; |
| 14 | while (--n > 0) { |
| 15 | b += a; |
| 16 | a = b - a; |
| 17 | } |
| 18 | return b; |
| 19 | } |
| 20 | |
| 21 | public static void main(String[] args) { |
| 22 | Solution solution = new Solution(); |