Continuing the discussion from KBALANCE - Editorial:
Consider the test case:
1
9 2
000100010
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