• Additional tests have been created. It may be a while before this solution is invalidated however ( if ever ).

  • Like this. .chars and .split("") will do the same thing.

  • Or use a Set 'duuuuh' haha

  • That is DRY ideology :)

  • Be good if the OP created some additional tests to invalidate this solution. It's simple and works but would only be useful for decimals up to 9 decimal places. If we were dealing with numbers with 10000 decimal places long then what? Would this be a safe solution in production if you just used a large number for 'var c'? What do people think?

  • Highly agree to this solution! At least a chance must be given to the 'cheater' to justify their code and perhaps come up with an alternative solution. Removing honour and the solution to the kata is also a much better solution contrasted to locking accounts or banning people from using the website (be it temporarily or permanently).

  • ...now I feel like a dumbass haha

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

  • Gosh! Quite a difference in performance.

  • A tricky one but I don't think people should be penalised re: locking accounts etc. I think if a solution can be properly pegged down as cheating then remove their solution and their honor if needs be, leave a reason why and challenge that person to rethink their answer. Overall I think that's a positive solution for everyone and leaves out any negativity.

    However for some solutions, I've found I could argue a case against some of the test cases written by the OP as sometimes I find they can be outside of the scope of the original challenge set.

    Also another example is this, sometimes I think why spend hours creating a mathematically simple, but theoretically complex algorithm when the only solutions you are looking for are only a handful in a vast range, and these are already known or easily accessbile online. If you can create a simpler program which takes less time to process and fulfills the requirements of 200 test cases then I see that as a perfectly viable answer and in some way challenges the OP to further adapt his kata if he needs to.

    I've been having this debate with a couple of people regarding a couple of kata I've come across and I think it bears an interesting argument. So I think that should be taken into account when people are considering jumping on the 'He's cheating!' bandwagon.

  • Just so you know guys the number 'n' in the test cases when submitted goes as high as 1,000,000,000. I'm guessing some Memoization is needed here :-S

  • Hey I forked a ruby script on GitHub containing a hash with key:value pairs for most keyboard characters (well at least the ones needed in this exercise). Check out my comment above yours if you need the link to it.

  • If any Ruby users are unsure of how to access the Morse Code table (admittedly myself included :-S). I managed to source a morse code table from GitHub and adjusted it so the syntax works with the latest version of Ruby. You can access it here and copy/paste into your script if that's easier/saves you time :-)