Minimum Reading Speed
pages[i] is the length of book . Each hour you read at most speed pages from a single book; if a book has fewer pages left, you finish it and wait for the next hour. Return the smallest integer speed that finishes all books within hours hours.
Hours needed at a given speed :
Constraints
len(pages)hours
Examples
EXAMPLE WALKTHROUGHclassic
A guided view of the published example, not a trace of your code.
INPUT
[[3,6,7,11],8]TASKminimum_reading_speed()
EXPECTED OUTPUT
4Start with the input values shown in this example.
Example 1 of 3
Input: pages = [3,6,7,11], hours = 8
Output: 4
Explanation: classic
Input: pages = [30,11,23,4,20], hours = 5
Output: 30
Explanation: one hour per book
Input: pages = [30,11,23,4,20], hours = 6
Output: 23
Explanation: one spare hour
Hint 1
H(v) only decreases as v grows, so binary search on v.
Hint 2
Compute ceilings with (p + v - 1) // v.