Python Sliding Window(Easy to understand)
```\nclass Solution:\n    def minFlips(self, s: str) -> int:\n        n = len(s)\n        diff1,diff2 = 0,0\n        alt1,alt2 = "",""\n        s=s+s\n        a
```\nclass Solution:\n    def minFlips(self, s: str) -> int:\n        n = len(s)\n        diff1,diff2 = 0,0\n        alt1,alt2 = "",""\n        s=s+s\n        alt1, alt2 = "01" * n, "10" * n\n        l=0\n        res = len(s)\n        for r in range(len(s)):\n            if s[r]!=alt1[r]:\n                diff1+=1\n            if s[r]!=alt2[r]:\n                diff2+=1\n            if r>=n:\n                if n%2!=0: # if 0th(Lth) bit are different with alt1,alt2 then n+1 bit will be same and vice versa\n                    if s[l]!=alt1[l]:\n                        diff1-=1\n                    if s[l]!=alt2[l]:\n                        diff2-=1\n                l+=1\n            if r >= n-1:\n                res = min(res,diff1,diff2)\n        return res
['Sliding Window', 'Python']