[JAVA 문제 풀이] 255. 피보나치 수

프로그래머스 (12945)
Stupefyee's avatar
May 14, 2025
[JAVA 문제 풀이] 255. 피보나치 수
notion image
 

내가 작성한 코드

class Solution { public int solution1(int n) { int a = 0; // F(0) int b = 1; // F(1) for (int i = 2; i <= n; i++) { int temp = (a + b) % 1234567; a = b; b = temp; } return b; // F(n) } }
Share article

stupefyee