[week 5] 주간 결산_이도윤 #15
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ 이번주 문제 풀이
[Lv 1]
[Lv 2]
📚 이번주 코테 공부 중 느낀점 / 배운 점
[Lv 2] 피보나치수문제를 풀면서 어느 단계에서부터는 결과가 실패로 나와 찾아보니n이 매우 큰 경우, n번째 피보나치 수는 언어가 표현할 수 있는 자료형의 범위를 넘어가 오버플로우가 난다라는 것을 알게 되었습니다. 평소 보기에 있던 케이스에 대해서만 생각해서 풀었다면 이제는 자료형의 범위를 고려하면서 오버플로우를 신경쓰며 풀어야 할 것 같습니다.피보나치 수의 경우, 44번째만 되어도 int의 범위를 넘어버리기 때문에
(A + B) % C = (A % C) + (B % C)를 활용해 풀어야합니다.결국, 문제에서는
F(n) % 1234567을 구하라고 한다면, 피보나치 수의 정의인F(n) = F(n- 1) + F(n-2)를 활용해(F(n- 1) + F(n-2)) % 1234567이 되며,F(n-1) % 1234567 + F(n-2) % 1234567로 풀어야 했던 것입니다.