Ad
  • Custom User Avatar

    Or use a Set 'duuuuh' haha

  • Custom User Avatar

    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?

  • Custom User Avatar

    ...now I feel like a dumbass haha

  • Custom User Avatar

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

  • Custom User Avatar

    Gosh! Quite a difference in performance.

  • Custom User Avatar
  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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 :-)

    https://gist.github.com/Lex-Castevet/fc0408dd7bc3aa3de149