Ad
  • Default 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.

  • Default User Avatar

    With this solution, I've tried to avoid the creation of a temporary string. In most cases, the string will not even be resized. By first putting the character in a temporary char and removing it from the string, I could have avoided any resize... I guess.