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
This is concise and nice to read, but becomes very slow for large arrays. Taking (1..1000000).to_a as an input, took nearly 5 min on my (old) machine.
No problem at all! But thanks for the note (and for the kata :-). I've submitted a modified solution, using the new method name.
Sorry for the inconveniences I've changed method name to
extract_file_name
your solution will not pass from now. Please let me know if you want some other convention to be applied.I'll keep that in mind, thanks a lot!
As a rule of thumb, never modify your inputs. Most langs have primitives that automatically "clone" but arrays are pretty much always mutable, so you should
clone
them before doing anything.Oh, I see. I tried a recursive solution and didn't think about keeping the input array intact. Thanks for the pointer :-)
Don't modify the input array ;-)
I might be wrong, but it seems like the random tests (for Ruby) always expect the value of x as the return value.
This comment is hidden because it contains spoiler information about the solution
No worries, thank you for your feed (I didn't think people could name a support function like me, but it was indeed pretty likely).
@myjinxin2015, we were editing the file in the same instant, I changed different things, apparentely; sorry for the inconvenience^^'
Yes, was talking about Ruby. Sorry for not mentioning the language.
Works like a charm now. Thanks for the quick fix!
It should be fixed.
Please re-test.
Thans for you feedback ;-)
I would assume it was for a naming collision: try now that I refactored, cheers :)
In Ruby?
Loading more items...