Anyone know what’s wrong with my code CodeChef: Practical coding for everyone. I failed to figure out the wrong case.
I debugged with this case
7
12 1
100101000101
12 2
100101000101
12 3
100101000101
12 4
100101000101
12 5
100101000101
12 6
100101000101
12 7
100101000101
—Output
11
12
11
12
11
12
11
And this
3
5 1
11110
5 1
11111
5 1
01111
—Output
5
-1
5
seems correct. sucks