https://leetcode.com/problems/koko-eating-bananas/description/
https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold/description/
위에 두문제 이분탐색으로 풀었고
find-the-smallest-divisor-given-a-threshold
koko-eating-bananas
이분탐색 핵심로직은 거의 문제인데
1.
while문에 들어갈 조건이
<= 이냐 < 가 다르고
2.
피봇값(미들값)으로 설정하는데
right = mid + 1
하고
right = mid
가 다른데
혹시 이유 아는사람 ..
이거때문에 굉장히 헷갈림..
<는 low == high일때 종료됨 target이 배열에 존재하는지 모를때 사용 <=는 target이 존재하는 경우에 사용. Loop마다 If문으로 target 체크해주고. 사실 뭘 쓰든 분기체크만 잘 하면 똑같음
https://www.acmicpc.net/blog/view/109