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.
Fixed (don't know about other languages yet)
This comment is hidden because it contains spoiler information about the solution
But that's exactly the main feature of Timsort, taking advantage of having already sorted subsequences. If there are 2 sorted ranges, it's just an
O(n)
merge.Because your solution is inefficient Python code, while
sorted
is a call to very optimized C function. I think even the bestO(n)
solution will at most be "nearly as good" as the top solution.I've just run your solution against the reference with 1000 tests (in their current form). Yours one is 3.5 times slower...
Edit: and even after implementing your solution efficiently, it's a bit slower than the approach you're talking about.
Edit2: raised array length to fixed number of 1000 random integers, your solution is already 2 times slower.
This comment is hidden because it contains spoiler information about the solution
Great to hear that you enjoyed it!
In fact all except tetranacci are zero padded and the firs four elements for every sequence are specified in that table.
Regards,
suic
No. See rule 3: "The first four elements of the sequence are determined by the first abbreviation in the pattern (see the table below)." If you look carefully the first 4 element are zero padded
table: