Ad
  • Custom User Avatar

    I don't think there's really a need for that last group because the Regex will leave the punctuation marks untouched anyway, and it's greedy by default, so it won't stop short of the end of a word.

  • Custom User Avatar

    It would probably be a good idea to cut some of the Sodoku rules out of the description (such as what given numbers are), since they have no bearing on the puzzle itself, and are kind of distracting.

  • Custom User Avatar

    It's probably because you tried to output a character that is not visual. For example, the code 127, which refers to DEL.

  • Custom User Avatar

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

  • Custom User Avatar

    It's definitely a little more inefficient, but I don't think that the inefficiency is a huge deal here. However, that is something to keep in mind.

  • Custom User Avatar

    NOTE: This is directed towards the author of this kata, @obnounce.

    The test output is messed up in some cases. The reason for this can be traced back to line 9, where the if statement is. This statement queries if the VALUE of the last element in the list is the same as the VALUE of the element that it is on. This can produce some weird output (especially since the cone variable is never reset). Here are some sample weird outputs.

    test_for({1, 0, 0}, 1)
    Testing for {1, 00}

    test_for({3,7,-99,81,90211,0,7}, 0)
    Testing for {3, 7-99819021107}

    The way to fix this is to change the if statement so that line 9 looks like

    if (i == arr.end() - 1) cone = "";

    This way, the if statement is comparing ITERATORS, not VALUES.