You are viewing a single comment's thread. Return to all comments →
I had the same issue, even though my solution wasn't the same.
It was caused by the fact that I was calling my solving function with arr directly instead of a copy of it. As in the function itself, arr is modified, the second call wasn't made using initial data but using modified data.
asc = homework(n, list(arr)) # -> works
also, I like the syntax:
asc = solve(s, ar[::])
desc = solve(s, ar[::-1])