Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Koko Eating Bananas

Difficulty: Medium

Acceptance: 68.00%

Points: 30.00

Koko loves to eat bananas. There are n piles of bananas, and the ith pile has piles[i] bananas. The guards have gone and will return after h hours. Koko can decide her eating speed of k bananas per hour. Each hour, she chooses one pile and eats k bananas from that pile. If the pile has fewer than k bananas, she eats all of them instead and does not eat any more bananas during that hour. Return the minimum integer k such that she can eat all the bananas within h hours.

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 = piles.length = 104
  • 1 = piles[i] = 10?
  • 1 = h = 10?
Companies:
Apple
Topics:
Binary Search
Locked Content
Access Restricted: Please Login to access the code editor and test cases.