
-Code
class Solution {
public int climbStairs(int n) {
int before = 0;
int answer = 1;
for (int i = 0; i < n; i++) {
int temp = answer;
answer = before + answer;
before = temp;
}
return answer;
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 15216번 Another Brick in the Wall (0) | 2025.11.23 |
|---|---|
| [LeetCode/Java] 83. Remove Duplicates from Sorted List (0) | 2025.11.22 |
| [LeetCode/Java] 69. Sqrt(x) (0) | 2025.11.22 |
| [LeetCode/Java] 67. Add Binary (0) | 2025.11.22 |
| [백준/Java] 27445번 Gorani Command (0) | 2025.11.22 |