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.
array.sort void return
im late, but nice!
How would that make it harder?
It is explained why Paul is selected, what do you mean you're mislead?
You shouldn't return the winner, that's not what is asked.
No need, there is already this and this
When I first had the idea for this kata, I coded it up with the arrays of odds/evens etc. It's the natural starting point. It wasn't until I was checking the code through tests that I realised a neater solution. I then decided to be mean and time everyone else out 😂. It wasn't until I saw the commenting on one of the python solutions that I actually realised why the quick way works.
The really important lesson here is, if your code times out, the reason is likely your approach and not a bunch of tiny micro-optimisations. If your O(n) solution times out, then there must be a mathematical pattern hiding somewhere...
Done :-) The code was really one of the simpliest I've ever written. On the other hand I'm glad I found the other way too, even though it was showing the error. I learned a few new things along the way. I let the previous version commented in my code, if anyone wants to see my dead end solution :-)
Yeah, I created arrays :-) Not instead of thinking about the smpler way though. I was thinking quite a lot. I'm a beginner in python and I've never been good in math (30+ years ago back in the school...). I mangaed to write a code though that works, although it shows the memory error. I take it as my small victory :-)
Here's my latest attempt....well, it seems like it can't be pasted here. Nevermind. I'm not going to rewrite the whole line.
OMG! Who else created arrays of odds and evens instead of thinking of the simple way to do it? It took me ages, feel so stupid....
I've been thinking about it for about five days and I have no clue what to do with that. I know I'm stupid. I'm writing it here just so the others felt less stupid, knowing they're not alone :-D
Why did it take you so long?