Search
⌘K

Leetcode 1888. Minimum Number of Flips to Make the Binary String Alternating

Given a binary string where you can perform any number of cyclic rotations for free and flip individual bits at cost 1, find the minimum flips needed to make the string alternating (no equal adjacent bits). The core challenge is to compare s under all rotations against the two alternating patterns ("0101..." and "1010...") and minimize mismatches efficiently (n up to 1e5).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.