Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Koko Eating Bananas
Bookmark
Brute Force
Binary Search on Answer
Input
Example 1
Example 2
Example 3
Min speed
Small piles
Custom
piles
=
[3, 6, 7, 11]
,
h
=
8
piles
0
3
1
6
2
7
3
11
h = 8
piles
0
3
1
6
2
7
3
11
h = 8
piles
0
3
1
6
2
7
3
11
Try speeds from 1 to max(piles) = 11
piles
0
3
1
6
2
7
3
11
3h
6h
7h
11h
speed = 1
totalHours = 27 > h = 8 ✗
piles
0
3
1
6
2
7
3
11
2h
3h
4h
6h
speed = 2
totalHours = 15 > h = 8 ✗
piles
0
3
1
6
2
7
3
11
1h
2h
3h
4h
speed = 3
totalHours = 10 > h = 8 ✗
piles
0
3
1
6
2
7
3
11
1h
2h
2h
3h
Minimum speed = 4
totalHours = 8 <= h = 8 ✓
algo
master
.
io
Step:
Start: find the minimum eating speed for 4 piles with h = 8 hours
0 / 5
Input
Example 1
Example 2
Example 3
Min speed
Small piles
Custom
piles
=
[3, 6, 7, 11]
,
h
=
8
0 / 5
algo
master
.
io
Step:
Start: find the minimum eating speed for 4 piles with h = 8 hours