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.
This comment is hidden because it contains spoiler information about the solution
As your code mutates the input list (as I already said), the reference function gets that as input and returns wrong expected results.
arr.pop(0)
mutates the list. Try using a copy. And I'll close this issue, because FArekkusu created another one about the input being mutable in Python.Please do, use markdown formatting and mark your post as having spoiler content.
I've tried the reference solution and I got these results for the input you mentioned:
Actual and expected order is ok in the tests, so we can discard that as a problem.
Could you print the input before you return so you can be really sure the list was not mutated?
Are you mutating the input list?
I've tested in repl.it and failed too for the reason I told.
Not a kata issue, either remove it from the if or add parentheses so the assignment is done before the comparison, right now it's doing the comparison first and assigning that to
$pos
.Read about operators precedence