Minimum Changes To Make Alternating Binary String LeetCode solution in Python
1# Runtime: 52 ms (Top 66.2%) | Memory: 16.53 MB (Top 16.1%)234class Solution:5def minOperations(self, s: str) -> int:6count = 07count1 = 08for i in range(len(s)):9if i % 2 == 0:10if s[i] == "1":11count += 112if s[i] == "0":13count1 += 114else:15if s[i] == "0":16count += 117if s[i] == "1":18count1 += 119return min(count, count1)