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.
It's certainly more intricate than it needs to be ;)
Assymptotic complexity is just one way of thinking about algorithm performance. As I've already pointed out, it ignores overhead, so it's not the whole story. Also, there's lots of other tricks to improving algorithm performance.
Anyway, in the Kata description you have:
The specifics of the specs of the codewars backend are subject to change, so you can't really account for architecture here when designing your solution.
As general advice, this is a 4 kyu kata, so you are expected to write an efficient solution.
Thanks, I've fixed this.
Ok, now I assume that time-limit for every kata is 5 secs. You atleast need to provide how many tests are being made. And by "deciding time-complexity", I mean say for instance if a simple O(N^2) solution suffices, why would we want to write a complex O(N) solution? The decision can be made only if you can provide number of tests, time-limit(which I assume is 5secs) and the processor speed on which the code is being executed. To comprehend better, see a problem on spoj.com
First: Just because an algorithm has good time efficiency doesn't mean that it's efficient in the real world. The classic example is the Coppersmith-Wingrad algorithm for matrix multiplication, which has the best known time complexity of any matrix multiplication algorithm but has a massive constant overhead that means its never used in real life.
Second: I don't set the timeout for this kata (or any kata). It's no more than 5 seconds, although this is potentially subject to change. The server will report when there is a timeout.
Please include the maximum time with in which the program has to execute. This helps us to decide what time-complexity should our code be written.
Its too easy to solve. Not much coding needed. Perhaps, it would have been better, if the sequences vary.
This comment is hidden because it contains spoiler information about the solution