Conversation
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.
관련 이슈
작업 내용
[풀이방식]
(내림차순 이유는 코드에서 추가 설명)
2-1) B의 최소값보다 타겟의 값이 적을 경우 → 타겟이 먹을 수 있는 대상이 없음
2-2) B의 최대값보다 타겟이 큰 경우 → B의 모든 값을 먹을 수 있음
[로직 추가 설명]
문제 요약
(= A의 숫자들이 B를 먹을 수 있는 경우의 수를 구하라)
고민 방향
현재 이진 탐색 코드에서 if를 이용해 정답 조건에 해당하는지 한번 더 검증하고 있다.
이런 방법을 쓰지 않고 바로 정답을 구할 수 있는 방법으로 리팩토링이 가능할지 고민중이다.
정답 조건을 추가 점검하는 if문이 없어도 정답일것이라고 생각했으나, 해당 부분을 제거하면 문제를 틀리는 상황이 발생했다.
이 부분이 가독성을 떨어트리는 것 같다.