KBalance(what is wrong with my code)

Continuing the discussion from KBALANCE - Editorial:

this is link to my code:- Solution: 51456809 | CodeChef

Consider the test case:

9 2

Correct output: 1
Output by your solution: 2

Its optimal to flip the ‘0’ at index 6 (1 based indexing) to get 2-Balanced string.

1 Like

thanks man for ur time!!
i figured it out

even now getting wa