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.
very easy to read solution
wat
But is it a simple loop? I've done it a thousand times and it's always been fine. And then suddenly it started like this
Easy to read, but it's O(n^2) and there's an even shorter solution that's O(n).
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
what is the faster solution? coz mine is basically yours but it took 7k seconds to run lol.
The square brackets aren't needed. And using them creates a list that makes your solution O(n) in space when can be solved in O(1) space.