Skip to content

Bug Report for eating-bananas #4065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mhdadk opened this issue Apr 21, 2025 · 0 comments
Open

Bug Report for eating-bananas #4065

mhdadk opened this issue Apr 21, 2025 · 0 comments

Comments

@mhdadk
Copy link

mhdadk commented Apr 21, 2025

Bug Report for https://neetcode.io/problems/eating-bananas

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

Not necessarily a bug, more of an optimization for clarity of the code. The line res = r after the line l, r = 1, max(piles) is unnecessary, and I believe it was left over from the solution given in the video.

In the video, the solution involved updating res as res = min(res, k). However, this was also unnecessary, as it was always true that k < res due to the nature of binary search. Because this was unnecessary, the line res = r above also becomes unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant