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.
yep...
Big O Notation on a 6kyu kata ? :(
because this is O(n²). You need an O(n) algo.
Thanks. I didn't pick that up from the introduction text. Perhaps it should be more promenant, and maybe a unit test for performance. I've refactored my answer successfully.
Tag added.
Sorry for the Spoiler tag its my first time here hehe
Ok i will try changing that thanks!
Yes, mark your post as having spoiler content next time.
About your code, it seems
unshift
is expensive in computing time, try doing it in another way.This comment is hidden because it contains spoiler information about the solution
Add
performance
tag to the kata. Maybe clarify what "Some lists can be long." means ;)yes, you need something more efficient (inputs are huge, in the full test suite)
This comment is hidden because it contains spoiler information about the solution