Java Simple, Small, O(N) Solution
\tclass Solution {\n\t\tpublic int minFlips(String s) {\n\t\t\tint n=s.length();\n\t\t\ts+=s;\n\t\t\tint minOperations=n,cnt1=0,cnt2=0;\t\n\t\t\tfor(int i=0;i<2
\tclass Solution {\n\t\tpublic int minFlips(String s) {\n\t\t\tint n=s.length();\n\t\t\ts+=s;\n\t\t\tint minOperations=n,cnt1=0,cnt2=0;\t\n\t\t\tfor(int i=0;i<2*n;i++){\n\t\t\t\tif(s.charAt(i)-\'0\'!=i%2)    cnt1++;\n\t\t\t\telse  cnt2++;\n\t\t\t\tif(i>=n){\n\t\t\t\t\tif(s.charAt(i-n)-\'0\'!=(i-n)%2)    cnt1--;\n\t\t\t\t\telse    cnt2--;\n\t\t\t\t\tminOperations=Math.min(minOperations,Math.min(cnt1,cnt2));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn minOperations;\n\t\t}\n\t}
[]