Grokking Coding Mock Interview
Ask Author
Back to course home

0% completed

Solution: Koko Eating Bananas
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. She has h hours before the guards return.

Each hour, she can pick any one pile and eat up to k bananas from it. If the pile has less than k bananas, she finishes that pile and doesn’t eat more in that hour. She cannot eat from more than one pile in an hour.

Find and return the smallest possible value of k (bananas per hour) so that she can eat all the bananas from all the piles in h or fewer hours.

Examples

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible