Ad
  • Custom User Avatar

    The only case the details says will not be tested is an empty string.
    The input should consist of only binary didgets and those didgets should only represent numbers which are multiples of three.
    anything else your regex should fail to match.

  • Default User Avatar

    Thank you, I finally got it! My mistake was that I iterated i from 1 to s1.length and therefore the 0th character of s3 (that after reversion became the last) was skipped.
    I had tried running it in VS, but VS doesn't show this "null-character". I found it via an online compiler.

  • Custom User Avatar

    Your solution contains an off-by-one error which causes some trash to appear at the end of your string.

    The error is 100% reproducible, so you should be perfectly able to find it running your solution in your local IDE and stepping through it with a debugger. Did you try?

  • Default User Avatar

    Wait, it is claimed that The input should consist only of binary digits - no spaces, other digits, alphanumeric characters, etc.
    But in the next string the last example for JS ismultipleof3Regex.test(' abc ') should be false.

    But ' abc ' can NOT be input, because it contradicts the condition, can it?

  • Default User Avatar

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

  • Custom User Avatar

    It's difficult to say witout seeing your code, but I guess that either your strings contain some garbage at the end, or they are not terminated properly, or you write outside of some buffer and destroy the assertion message.

  • Default User Avatar

    If it matters, I get a inverted string and to reverse it I use string(s.rbegin(), s.rend() and reverse(s.begin(), s.end(). Neither works.

  • Default User Avatar

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