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 solution is O(N) in time. The "in-place" solution you are mentioning is O(N/2) which boils down to O(N) too, since 1/2 is just a constant factor.
The true difference between them lies in their space complexities. This one is O(N) in space, although it is simply mutating the input. But the "in-place" is O(1) in space because it does not use any auxiliary memory.
I still prefer this solution though, as you only need to user lower() once and it is very readable overall. Also, memory has become extremely cheap nowadays and it shouldn't be that much of a problem.
But this is not optimal solution in terms of BigO.
There is better "in-place" solution
This comment is hidden because it contains spoiler information about the solution
I had a very similar solution to you. I really like pop because it returns the removed value. It was perfect for this kata. Cheers
This comment is hidden because it contains spoiler information about the solution