Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
In Python, if the user's solution modifies
traffic
, test cases break. In the tester code, pass a COPY of the list to the solution withtraffic[:]
to fix this.In the meantime, I managed to submit my solution by copying the traffic list like this:
t = traffic[:]
and using my copy to solve the problem.It's a side effect of the other issue ("The user can modify the input").
I know it sounds kinda stupid, but the sensei should mention that multiple cars can pass in one go, and that the order of the cars is important
Otherwise, this kata is quite a fun one to solve
Or, assuming you're not modifying the input (which you do here), compute the expected result before calling the user's solution.
Prior to running the user function: make an additional, distinct copy of the input, send one to the user (which they can mutate if they wish), and send the other one (uneffected) to your reference solution.
All random tests expect an answer of one, even when the correct result is clearly way above one.
Ok, thanks. But how to fix it?
The user can modify the input.
Ok, thanks, now I tried, and i failed on this example/test: [15, 13, 7, 26, 10], 30). Output should be 3, right? (15+13),(10+7),(26) Or, i guess order is important. Ok, got it.
The tests have something like this
([1, 1, 1, 1, 1, 1, 1], 8)
In this case, all cars will pass at once. Cars stand in line one after another.Could I ask: how many vehicles can pass in the same time? How many tracks are on the road? Are two vehicles in one pass - max?
Thank you, I will try to do it as soon as possible.
not an issue a suggestion.
Loading more items...