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.
True. I read somewhere though that Big O notation specifically focuses on the worst case scenario. So I'd assume when dealing with conditionals you have to take whichever branch that will result in the largest runtime, meaning you have to include the splice. Not sure about that though I'll have to look it up.
See - 2. if-then-else statements:
http://pages.cs.wisc.edu/~vernon/cs367/notes/3.COMPLEXITY.html#application
Is the second solution really O(n) time, You do have a splice - O(n), nested inside a reduce loop - O(n), nested inside a filter loop - O(n), wouldn't that make it O(n * m * m)? I'm thinking the first solution is faster since it's only 2 levels nested, just the sort stuff inside the filter loop O(n * nlogn)