I was reading an interview experience of AppDynamics and came across this question. Can anyone help me to solve this.
Given a string consisting of 0’s and 1’s and we have to find minimum flips to convert string to all 0’s.
Here if we flip a character then all characters to the right will be flipped as well.
EX: 1000
flip 1 at 0 index then 000 to the right of it will also get flipped resulting 0111
flip 1 at index 1 resulting 0000. So answer is 2 flips.O(N) is expected