[C++] Short, concise and easy to understand
\nclass Solution {\npublic:\n    int minFlips(string s) {\n        int mn1=0,mn2=0,n=s.length(),ans=INT_MAX;\n        if(n<2)return 0;\n        string S=s+s;\n 
```\nclass Solution {\npublic:\n    int minFlips(string s) {\n        int mn1=0,mn2=0,n=s.length(),ans=INT_MAX;\n        if(n<2)return 0;\n        string S=s+s;\n        vector<int>t1(2*n);\n        vector<int>t2(2*n);\n        for(int i=0;i<(2*n);i++){\n            mn1+=((S[i]-\'0\')^(i%2));\n            mn2+=((S[i]-\'0\')^((i+1)%2));\n            t1[i]=mn1;t2[i]=mn2;\n            \n        }\n        ans=min(ans,min(t1[n-1],t2[n-1]));\n        for(int i=n;i<(2*n-1);i++)ans=min(ans,min(t1[i]-t1[i-n],t2[i]-t2[i-n]));\n        return ans;\n    }\n};\n```
[]