algorithm/python
프로그래머스/이분탐색/입국심사
아르르르를를르
2022. 6. 30. 19:30
https://programmers.co.kr/learn/courses/30/lessons/43238
def solution(n, times):
answer = 0
left = min(times)
right = max(times) * n
while left <= right:
mid = (left + right) // 2
checked = 0
for time in times:
checked += mid // time
if checked >= n:
break
if checked >= n:
answer = mid
right = mid - 1
elif checked < n:
left = mid + 1
return answer