Send your feedback or ask for help here!
I’ve got code that tests 100% and fails to pass validators #3 and #6.
So I’m complaining here.
I didn’t verify my theory with the last testcase and validator, but my guess:
you take groups of 1s and compute the length of two consecutive groups + 1. You don’t check, how many 0s are between, as this will only work when there is just one 0.
I added some more test cases, hopefully they will clarify what to do.
Oh, I know what that code did wrong.
I’m just complaining about the moderation O:-)
That’s exactly what I assumed
Every test is done succesffully, but validator 4 (50 bits) fails. Do you have any idea why?
I don’t know how your solution might be handling it differently from every other case but I’ve switched the test case with the validator case for 50 bits so you can see it.
I done every test successfully, but validators 5, 7 and 11 fails.
I’ve added those validators as extra test cases.
I break the string into sections of 1s. So a string of length 1000 can be reduced into a few dozen sections or less. Brute force to find which two adj sections can be combined into the longest all-1s.
Hi, thanks @java_coffee_cup,
I wonder what if there is no 1s and it’s just a string of 0? you cannot splice anything. Also for the gaps it sounds difficult to code.
I managed to find a solution (which i’m still working on) but i have to finish it: first identify 0s, then change each 0 for 1, then compare results
I treated them as special cases to handle quickly
if list of section is empty return ans else if list size is 1 return ans else normal cases
At last I ended up splitting the string into sections of 1s and I found the way. This community is very helpful <3
Looking at my own code, I think there is a missing test case: All 1s.
That would imply that no bits can be flipped.
I have a code that passes all the tests but the validator #7 seems to pose a problem to it, can anyone tell me why ?
thank you !