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
It's no bad thing to import modules if they get the job done! There's a time and a place for code golf. That said - with the distance of several years' hindsight - I should probably have added a short comment.
Really nice! I saw someone else use a for-loop with an xor operator (i.e. "^") which is similar and doesn't need an import. I like this the best because it is O(n) and it is very clean. It's a bit more arcane than the simplest solution, but for large values of N this is definitely the right approach.
Good work :)
Your post was visible in the homepage, that's why you should use spoiler flag here.
Why is this a spoiler? I'm not providing a different solution, I'm explaining why this solution is faster than others.
PS I get it. It compares 2 solutions and one of them is not here. Sorry about that.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
There's no need for the condition because it returns 0 by default
I thought it returns False if the array is empty
it defaults to 0 when you would think it's 'null'
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
However,
s
is better thatstr
becausestr
is a built-in type in pythonyep, but the inputs are too small in the test suite (at least when I posted this), so that worked with py3 too, while it's incorrect.
Loading more items...