Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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.
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?
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 is
multipleof3Regex.test(' abc ') should be false
.But ' abc ' can NOT be input, because it contradicts the condition, can it?
This comment is hidden because it contains spoiler information about the solution
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.
If it matters, I get a inverted string and to reverse it I use
string(s.rbegin(), s.rend()
andreverse(s.begin(), s.end()
. Neither works.This comment is hidden because it contains spoiler information about the solution