All Posts
Leetcode 1888: Minimum Number of Flips to Make the Binary String Alternating
You are given a binary string s consisting of ‘0’s and ‘1’s. You can perform two operations on the string:
- Type-1: Move the first character of the string to the end.
- Type-2: Flip the value of any character in the string (‘0’ becomes ‘1’ and ‘1’ becomes ‘0’). The goal is to make the string alternating, i.e., no two adjacent characters should be the same. You need to find the minimum number of type-2 operations required to make the string alternating.