Ad
  • Custom User Avatar
  • Default User Avatar

    It's certainly more intricate than it needs to be ;)

  • Custom User Avatar

    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:

    Your code should be able to compute all of the smallest 5,000 Hamming numbers without timing out.

    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.

  • Custom User Avatar

    Thanks, I've fixed this.

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Its too easy to solve. Not much coding needed. Perhaps, it would have been better, if the sequences vary.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution