See here for the problem.

What I did here is that I found the longest and the second-longest substrings of '0’s .

And then applied the following :

if( isEven( longest ) || ( isOdd( longest ) && secondLongest >= ( longest +1 ) / 2 )

“No”

else

“Yes”

But it seems this logic is wrong. Can someone tell a test case which doesn’t works ? Also, what is the correct logic? In brief