90% FASTER || C++ || SLIDING WINDOW
\nclass Solution {\npublic:\n    int minFlips(string s) {\n        int ans = INT_MAX;\n        int n = s.length(),x=0,y=0;\n        for(int i = 0; i < n*2; i++)
```\nclass Solution {\npublic:\n    int minFlips(string s) {\n        int ans = INT_MAX;\n        int n = s.length(),x=0,y=0;\n        for(int i = 0; i < n*2; i++){\n            x += (s[i%n]-\'0\' != (i%2));\n            y += (s[i%n]-\'0\' != (1-i%2));\n            if(i>=n-1){\n                if(i>=n){\n                    x -= (s[i-n] != ((i-n)%2)+\'0\');\n                    y -= (s[i-n] != (1-(i-n)%2)+\'0\');\n                }\n                ans = min({ans,x,y});\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'Sliding Window', 'C++']