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.
Hmm... I'm not exactly sure how to start this. Could I have a hint, please?
Hmmm... Iterating through the list is better than popping off the list?
Popping all the elements off a list takes O(cn) time if c = "lag time" for each popping.
Iterating through all elements of a list takes O(n) time.
So although iterating might be faster, in terms of asymptotic runtime, both take the same time.
...Unless c contains a term of n (i.e. log(n), n, n^2)?
Hello everyone,
There is an issue with the code. If you mutate ANY of the parameters, such as popping off of moves, the random test case fails.
I read the question again and it doesn't appear to tell that inputs should not be mutated. Please add this warning to the problem.
Essentially, the moves list must not only be copied, but deep copied so the original moves list doesn't get mutated.
Just so this post doesn't spoil the answer, I will leave it up to the reader to figure out how to deep copy.