1529. Minimum Suffix Flips

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1529

class Solution:
    def minFlips(self, target: str) -> int:
        res = 0
        for v in target:
            if (res & 1) ^ int(v):
                res += 1
        return res