Ad
  • Custom User Avatar

    I don't think that my c++ solution uses any (advanced) math skills.

    It only uses one optimization that you must have seen (and probably used) in previous katas on level 6.

    It's a bit of a brute force solution, since it does not use the related theorems, but all tests did pass.

    If I look at Firefly2002's solution, I like it much more than the one of mine, but I'm not sure that it has a lower O() complexity thand the one of mine (but it can be much faster for the simple cases).

    But, reading further down in this discussion, I see that slower language might have a harder time finishing the task fast enough... so you might be right.

  • Custom User Avatar

    A bit of googling should help you out with this; there's a specific equation for part of the problem you can use.