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

    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.