• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 13, 2022 |410 Views

Minimum flips of continuous characters to make all same in a binary string

  Share   Like
Description
Discussion

Given a string consisting only of 1’s and 0’s. In one flip we can change any continuous sequence of this string. Find this minimum number of flips so the string consist of same characters only.
Examples: 
 

Input : 00011110001110
Output : 2
We need to convert 1's sequence
so string consist of all 0's.

Input : 010101100011
Output : 4

Minimum flips of continuous characters to make all same in a binary string: https://www.geeksforgeeks.org/min-flips-of-continuous-characters-to-make-all-characters-same-in-a-string/