// Package q1758 implements a solution for https://leetcode.com/problems/minimum-changes-to-make-alternating-binary-string/ package q1758 func minOperations(s string) int { a, b := 0, 0 var alt byte = 1 for i := range len(s) { if s[i]-'0' == alt { a++ } else { b++ } alt = alt ^ 1 } return min(a, b) } var _ = minOperations