...
/Minimum Flips to Make the Binary String Alternate
Minimum Flips to Make the Binary String Alternate
Try to solve the Minimum Flips to Make the Binary String Alternate problem.
We'll cover the following...
Statement
Given a binary string s
, the following two operations can be performed in any sequence:
-
Type–1: Remove the character at the start of the string
s
and append it to the end of the string. -
Type–2: Pick any character from the string and flip its value. in other words, if its value is , it becomes and vice versa.
Your task is to return the minimum number of type- operations that you need to perform before s
becomes alternating.
Note: The string is called alternating if no two adjacent characters are equal.
Constraints:
-
s.length
s[i]
is either or .
Examples
Access this course and 1400+ top-rated courses and projects.