Ad
  • Custom User Avatar

    ngl this is the most readable and clean version in my opinion. My only issue with it is that at a glance it looks like you're reversing a string and then making it inot an array just so you can make it into a different string. It feel like an extra step but is it cus string(the type) is immutable?

  • Custom User Avatar

    The most concise version!

  • Custom User Avatar

    The heck is a static int in javascript?

  • Custom User Avatar

    duplicate issue (see @donaldsebleung's issue below)

  • Custom User Avatar

    25 dollars for a ticket?! Outrageous!

  • Custom User Avatar

    Updated random unit tests correcting the order of the expected and actual parameters to the assertion. The tests themselves were otherwise correct even though the output misreported what the test expected and what the test received. Marking resolved.

  • Custom User Avatar

    Thank you. Looking into this.

    Edit: The random test has actual and expected arguments swapped: the "Expected" is what your algorithm returned. So, I'm sorry for the confusion and will look into correcting this.

    Also, the area numbers employed are 64-bit signed integers and 1783715193 fits in just over 30 bits, and the real expected number 9898996673 comes in just over 33 bits. (Determined by taking log-base-2)

    Since the real issue appears to be that I swapped expected & actual parameters to NUnit's assert, the message is incorrect but the result still appears correct. If codewars will permit, I will try to correct the test code AND add code to prevent the possibility of overflow -- neither of which should impact anyone currently with a correct solution.

  • Custom User Avatar

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

  • Custom User Avatar

    Some random tests in C# expect negative area values:
    Expected: -1783715193
    But was: 9898996673

    Is this correct? It seems like a bug from overflowing the int datatype.

  • Custom User Avatar

    Could use a bit of refactoring...

  • Custom User Avatar

    Wow this should be the most appropiate answer!

  • Custom User Avatar

    First iterations would have a lot of characters to check for in the text, but the last ones would run much quicker because you are discarding the already checked characters.