Ezvor

2604. Minimum Time to Eat All Grains

HardArray Preparing judge… LeetCode
ArrayTwo PointersBinary SearchSorting

Hints

Hint 1
Binary search the answer.
Hint 2
To check if an answer is possible, for the ith hen check how far right it can go after ensuring that it eats the leftmost uneaten grain.
Hint 3
If the last grain is eaten in this process, the answer is possible.