-
-
Notifications
You must be signed in to change notification settings - Fork 248
[s0ooo0k] WEEK2 solutions #1767
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
Conversation
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.
Java는 익숙하지 않은데, 차이 비교하면서 코드 잘 보고 갑니다.
* 시간복잡도 O(n) | ||
* 공간복잡도 O(n) | ||
*/ | ||
public int climbStairs(int n) { |
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 (n == 1) return 1;
if (n == 2) return 2;
예외는 이렇게 써주는 것도 명확해서 좋다고 생각합니다.
추가적으로 풀어보신다면 변수 2개만 쓰는 공간 최적화 O(1)으로도 풀 수 있습니다.
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.
해당 방식으로 쓰는게 더 명확해보이네요 :) 조언 감사합니다!
@@ -0,0 +1,23 @@ | |||
class Solution { |
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.
정렬 없이 카운팅 방식으로만 풀어보셔도 좋을 것 같아요.
친절한 코드리뷰 감사합니다! |
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!