You have a shelf of books; pages[i] is the length of book i. You pick a reading pace p (pages per
hour) and then, every hour, read up to p pages from a single book. If fewer than p pages remain in
that book, you finish it and the rest of the hour is lost. Return the smallest integer pace that lets you
finish every book within hours hours.
Examples
Input: pages = [45, 120, 260, 75], hours = 6
Output: 120
Explanation: at 120 pages/hour the books take 1 + 1 + 3 + 1 = 6 hours; at 119 they take 7.
Input: pages = [45, 120, 260, 75], hours = 4
Output: 260
Input: pages = [10], hours = 10
Output: 1
Constraints
1 <= len(pages) <= 10**4,len(pages) <= hours <= 10**91 <= pages[i] <= 10**9- Required time:
O(n log(max(pages))). Trying every pace from 1 upward is far too slow.
Goals
- Turn 'minimum value that works' into a search over a numeric range
- Write a feasibility check using ceiling division