-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report for https://neetcode.io/problems/reverse-integer
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
A minor bug in the reverse Integer problem from Neetcode150 Bit manipulation-
In solution 3.Iteration the following line doesn't correctly compare the MIN bound for negative values
if res < MIN // 10 or (res == MIN // 10 and digit < MIN % 10):
return 0
Test case failing: x=-9463847412
Corrected code should instead be:
if (res < int(MIN/10)) or (res == int(MIN/10) and digit < int(math.fmod(MIN, 10))):
return 0
Metadata
Metadata
Assignees
Labels
No labels