You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
There are test cases that this solution doesn't account for. When tested, the posted car fleets solution fails. I used leetcode to check the solution, and I've posted the results as a screenshot here:
The problem formulations are identical, so they should in theory pass all test cases.
The text was updated successfully, but these errors were encountered:
Upon further review, it seems like the distance calculation needs to be casted to a float in order to achieve accuracy for more "neck-and-neck" cars, as the test case shown above represents.
The solution just needs to be updated to: stack.append(float(target - p) / s)
instead of stack.append((target - p) / s)
Bug Report for https://neetcode.io/problems/car-fleet
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
There are test cases that this solution doesn't account for. When tested, the posted car fleets solution fails. I used leetcode to check the solution, and I've posted the results as a screenshot here:
The problem formulations are identical, so they should in theory pass all test cases.
The text was updated successfully, but these errors were encountered: