66. Eating Speed
Medium
A kitchen has piles of bananas. Each hour, a person chooses one pile and eats up to velocidade bananas from it; if the pile has fewer than that, they finish the pile and wait until the next hour. Return the minimum integer speed that allows finishing all the piles within horas hours.
Example 1
Input: pilhas = [3,6,7,11], horas = 8
Output: 4
Example 2
Input: pilhas = [30,11,23,4,20], horas = 5
Output: 30
Constraints
- 1 <= pilhas.length <= 10000
- 1 <= pilhas[i] <= 1000000000
- pilhas.length <= horas <= 1000000000
Binary searchArrays
Saved in this browser
Caso 1
pilhas =
[3,6,7,11]
horas =
8
Expected =
4
Caso 2
pilhas =
[30,11,23,4,20]
horas =
5
Expected =
30
Run checks these 2 cases. Submit runs all 7, including hidden ones.