Conversation
sforseohn
reviewed
Nov 12, 2024
Member
sforseohn
left a comment
There was a problem hiding this comment.
[이분탐색 이론 문제 코드 리뷰 완료]
16401(P2)
예원님 안녕하세요! 이번 주도 과제하시느라 고생 많으셨습니다.
강의 시간에 배운 개념을 잘 적용해서 풀어주셨네요! 😎
몇 가지 코멘트 드렸습니다.
궁금한 점이 있다면 리뷰어를 호출해주세요!
Member
There was a problem hiding this comment.
P2. 맞아요! 이분탐색을 할 때는 탐색할 값들이 반드시 정렬되어 있어야 한다고 했죠. 🤗 그런데 이 문제에서는 가지고 있는 과자들의 길이 자체는 탐색하지 않으며, 이건 순서에 상관없이 주어진 길이로 과자 몇 개를 나눠줄 수 있는지 계산할 때만 사용돼요. 그래서 snack을 따로 정렬해주지 않아도 됩니다!
Comment on lines
41
to
52
Member
There was a problem hiding this comment.
P2. 모든 조카에게 같은 길이의 과자를 나눠줄 수 없는 경우, 탐색의 마지막 left와 right값이 어떻게 될지 생각해 볼까요? 과자의 길이를 계속 줄이다가 결국 과자의 길이가 1일 때도 나누어줄 수 없기 때문에, right는 mid(1) - 1 = 0이 되고, 이때 left(1) > right(0) 이기 때문에 반복문을 빠져나오겠죠. 즉 이 경우를 따로 분리할 필요 없이 return left - 1;로 처리할 수 있습니다. 😊
Comment on lines
55
to
76
Comment on lines
24
to
25
Comment on lines
28
to
39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
##인적사항
학번: 2171060
이름: 김예원
##과제 제출
기존 제출: 17266, 10815, 16401