-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[forest000014] Week 2 #719
Conversation
if (n == 1) { | ||
return 1; | ||
} else if (n == 2) { | ||
return 2; | ||
} else { | ||
int prev2 = 1; | ||
int prev1 = 2; | ||
int cur = 0; | ||
for (int i = 3; i <= n; i++) { | ||
cur = prev2 + prev1; | ||
prev2 = prev1; | ||
prev1 = cur; | ||
} | ||
return cur; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직은 좋다고 생각합니다! 개인적으로는 else if 문을 줄이는 방향으로 하면 가독성 면에서 좀 더 올라가지 않을까 싶어요!
for (int i = 0; i < s.length(); i++) { | ||
cnt[s.charAt(i) - 'a']++; | ||
} | ||
for (int i = 0; i < t.length(); i++) { | ||
cnt[t.charAt(i) - 'a']--; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위에 If문에서 이미 s와 t의 길이를 비교한 이후라면 둘의 길이가 같을테니, 하나의 for문으로 합칠 수 있지 않을까요? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2주차 문제풀이 고생 많으셨습니다!
문제 풀이에 대한 아이디어를 적어주신 점이 참 좋은것 같습니다.
3주차도 파이팅입니다!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.