🧠 Before you code — what pattern fits?
Koko has piles of bananas and h hours. Each hour she eats up to k bananas from one pile. Return the minimum integer k so she can eat all the bananas within h hours.
(piles=[3,6,7,11], h=8) → 4
(piles=[30,11,23,4,20], h=5) → 30
🎬 Video explanation · NeetCode
Your solution runs against 3 unit tests, including edge and large-value cases.
Loading...
Test console · 3 unit tests
Submit your code to run it against all 3 unit tests. Results appear here.
JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.