MCPcopy Create free account
hub / github.com/Blankj/awesome-java-leetcode / climbStairs

Method climbStairs

src/com/blankj/easy/_0070/Solution.java:12–19  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

10 */
11public 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();

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected