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.
Removed some time ago
Changed description to match the tests.
I fixed the description (start from the smallest sock and the largest gift, the last child is not special) and added small random tests.
wtf description says ALL buttons except the one triggering :/ I hate specs like this
Why on earth is this hidden? As long as the comment describes a correction to the description, and not a solution per se, it should not be flagged for spoilers.
No, when you find cheaters, feel free to report them here
fixed, also updated to new test framework
Damn, that's weird and genius actually
It's very obscure to figure out who exactly the "last" child is. I'm not convinced the kata expects correct results according to its own specification.
Okay I did some tests because I agree with what you said and I found a funny little thing.
First, here are the results for 10k tries on a random large test of this kata.
So I tried to find out why and it seems python has an implementation detail that changes things.
When doing string concatenation, if the left operator isn't referenced anywhere else, it is realloced to avoid creating a new object.
This isn't something to rely on but that explains the difference between my original and my fork.
However, I'm not sure why your solution is slower.
Probably because you're constantly updating a dict.
Edit: Alright, so my solution is better for big arrays and yours for big strings.
The difference between many small dict and a few big dict, the later is better.
Okay, I just realised I already did a fork to solve that.
Check it out.
Do you see a linear time solution?
Though this might be a cubic time solution, will check later. Too tired now.
In the context of this kata, it's a word that starts with a capital letter, maybe capitalized would be a better choice, but there are words with a mixture of letters in both cases and symbols. The definition of word is a little loose too, at least seeing the Python random tests.
In the example where it looped right I thought the end values would end up in reverse order at the beginning of the array e.g. loopArr([1, 5, 87, 45, 8, 9], 'right', 2) => [9, 8, 1, 5, 87, 45]. You should change the examples so there are not two of the same values for clarification, but other than that good problem!
Loading more items...