-
-
Notifications
You must be signed in to change notification settings - Fork 304
[ZetBe] WEEK 03 solutions #2097
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
radiantchoi
left a comment
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.
희원님 안녕하세요~ 어쩌다보니 제가 이번주는 리뷰를 드리게 됐는데요, 전반적으로 외워서 푸시기보다 문제가 원하는 것을 정확히 이해하고 푸시려고 하는 듯 한 인상이, 알고리즘 풀이에 썩 능하지 않은 제가 보기에도 보여서 재미있게 봤습니다. 제 경험에 입각한 코멘트가 대부분이긴 해서 살짝 민망하네요. 다음주도 화이팅입니다.
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.
저는 두 함수를 분리하고 싶다는 생각 때문에 파라미터가 많이 늘었는데, 파이썬의 특성상 이렇게 그냥 함수 하나 안에서 nested function을 정의해서 하면 그것도 괜찮겠구나 라는 생각도 들었습니다.
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.
실제 문자열을 붙이기보다 경우의 수가 될 수 있는 것만 하나하나 체크해서, n번째 인덱스에 있는 글자까지 체크해본 결과 이 정도 경우의 수가 나왔다~ 하는 풀이로군요! 저는 이번 주에 못 푼 문제인데, 재귀를 통해 직접 문자열을 만들어 봄으로써 해결해보려고 했던 기억이 납니다. DP는 정말 생각지도 못한 곳에서 튀어나오네요.
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.
저는 냅다 bin(n[2:]) 해서 나온 문자열에서 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.
이것도 저는 처음 풀 때 dp인지 몰랐는데, dp 배열을 생성하고 i번째 원소까지 고려했을 때의 최댓값을 저장한다 치면 dp라고 볼 수도 있겠더라고요. for문 1회 순회 방식으로 최적화가 될 수도 있었겠습니다만, 시간복잡도와 공간복잡도가 크게 달라지지는 않으므로 괜찮은 듯 합니다.
|
안녕하세요 경민님, 리뷰 감사합니다! 리뷰해주신 덕분에 이 pr은 merge하겠습니다 |
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!