Ad
  • Custom User Avatar

    Because when you access inputString[0] you get the unicode value of the first character so what he does is to substract the value of the character 0, because let's say "0" has a value of 32, then, 1 has a value of 33, and so on. So, when you substract 33 - 32 you get 1

  • Custom User Avatar

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

  • Custom User Avatar

    I updated the description to address the additional requirements, and updated the tests to force a re-evaluation of currently accepted solutions which should now fail.

  • Custom User Avatar

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

  • Custom User Avatar

    same here.
    I do find descriptions of SQL tasks bit cryptic.

  • Custom User Avatar

    woow so maybe the directions could have just said order randomly instead of that crappy wording they used

  • Custom User Avatar

    Given two solutions, you should pick the one with a wider first row. In your case, the first two slices are the same, but the last two slices could be cut two ways, and your solution has the less wide third slice.

  • Custom User Avatar

    When I've created this kata I am pretty sure those titles didn't exist. I don't use codewars anymore, so I don't know if someone else changed it or maybe the underlying name generator functions have changed instead. Unfortunately I don't have the time to look at this right now, but I just wanted to let you know that those titles weren't there by design.

  • Custom User Avatar

    The description does not match the current requirements, and the top solutions match the current requirements either. This kata has obviously been changed, probably adding the data with titles (such as MISS, DDS, and IV). Trying the top solutions now will cause them to time out, and if they didn't they would likely fail due to not accounting for titles.

    The problem description should be updated to mention the additional complication of titles, and if possible solutions accepted before the kata changed should be removed.

    Aside from that, this problem is very pleasantly challenging. I learned a lot, so thanks for making it!

  • Custom User Avatar

    I'm pretty sure they've changed the requirements since the top voted answers were accepted. For example, those don't deal with the titles (such as DR. or III). So it's probable that the prospects table is larger, and it's possible that they've also further constricted the runtime requirements.

    It would be nice if they had either removed former top solutions or released the current more difficult version as a new kata.

  • Custom User Avatar

    Try adding this case to the test suite: [1, 2, 2, 1, 3], should return 3

    If the numbers aren't ordered, you're in for a world of hurt. But it's a good approach if you order them first!

  • Custom User Avatar

    Tried this and failed for me too.