반응형
def solution(stones, k):
left, right = 1, 200000000
while left <= right:
print(left, right)
mid = (left + right) // 2
count = 0
for s in stones:
if s <= mid:
count += 1
if count >= k:
break
else:
count = 0
if count >= k:
right = mid - 1
else:
left = mid + 1
return left
이분탐색