leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

Bug Report for eating-bananas

Open mhdadk opened this issue 1 year ago • 0 comments

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.

mhdadk avatar Apr 21 '25 00:04 mhdadk