-
-
Notifications
You must be signed in to change notification settings - Fork 304
[radiantchoi] WEEK 03 Solutions #2098
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.
리뷰를 너무 늦게 달아드려 죄송합니다 🥲
아직 풀이중이신거 같아서 대기하다가 까먹고 지금에서야 남기네요 ㅎㅎ
현재 풀이 올리신 것 기준으로 작성 했습니다.
늦은 만큼 바로 승인 해두겠습니다!
이번 한 주도 수고하셨습니다~
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.
간단 명료한 풀이네요!
len, filter 대신 sum, map을 써서 더 짧게 가능할까? 했는데, 아쉽게도 안되네요 ㅎㅎ
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.
원래는 Swift에 익숙한지라, 이렇게 배열 자체를 고차함수를 통해 조작하는 것이 좀 더 직관적으로 다가왔던 것 같습니다ㅎㅎ..
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.
전반적으로 깔끔한 재귀 풀이 방법같이네요!
보기 좋습니다.
| # starting 인덱스가 필요한 이유는, 결과 케이스의 원소 순서가 중요하지 않기 때문 | ||
| # 즉, [2, 3]과 [3, 2]가 같은 케이스이기 때문 | ||
| # 인덱스에 따른 가지치기 적용, 잠재적 중복 케이스 제거 | ||
| for i in range(starting, len(candidates)): | ||
| candidate = candidates[i] | ||
|
|
||
| # 앞서 투입했던 current 배열을 인-메모리 조작하여 원소 삽입 | ||
| current.append(candidate) |
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.
current[i - 1] <= current[i]를 만족하기 때문에, current를 이용하면 starting 파라미터를 제거할 수 있습니다 👍
하지만, 코드 라인이 늘어나는 단점이 있네요 ㅎㅎ
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.
그렇네요. 정렬을 하고 나서 푸는 게 그런 효과도 있을텐데 미처 생각을 못 했던 듯 합니다. 파라미터 하나 늘어나는 것과 코드 라인이 한 줄 늘어나는 것의 트레이드오프는.. 그때그때 판단해 볼 만 하겠어요!
|
@ys-han00 님 리뷰 감사드립니다! 제가 이번주에 개인적인 사정으로 금요일까지 많이 못 했습니다만, 풀어서 올린 것에 대해 정성들여 리뷰해 주셔서 도움이 됐습니다. 앞으로는 풀리는 대로 빠르게 올리는 것도 괜찮겠단 생각이 드네요! |
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!