C++| Sliding Window | O(N)
\nclass Solution {\npublic:\n    int minFlips(string s) \n    {\n     int n = s.size();\n     string ss = s+s;\n     string s1, s2;\n     int ans = INT_MAX;\n  
```\nclass Solution {\npublic:\n    int minFlips(string s) \n    {\n     int n = s.size();\n     string ss = s+s;\n     string s1, s2;\n     int ans = INT_MAX;\n     for(int i=0; i<ss.size(); i++)\n     {\n         s1+=(i%2?\'1\':\'0\');\n         s2+=(i%2?\'0\':\'1\');\n     }\n     int ans1 = 0, ans2 = 0;\n     for(int i=0; i<ss.size(); i++)\n     {\n         if(s1[i]!=ss[i]) ans1++;\n         if(s2[i]!=ss[i]) ans2++;\n         if(i>=n-1)\n         {\n             if(i!=n-1 && s1[i-n]!=ss[i-n]) ans1--;\n             if(i!=n-1 && s2[i-n]!=ss[i-n]) ans2--;\n             ans = min({ans,ans1,ans2});\n         }\n     }\n     return ans;\n    }\n};\n```
['C', 'Sliding Window', 'C++']