C++ simple solution || Explained !!
The idea is \n-> Create the prefix arrays odd and even represents number of flips required to make string alternative starting with odd positions \'1\' and even
The idea is \n-> Create the prefix arrays `odd` and `even` represents number of flips required to make string alternative starting with odd positions \'1\' and even positions \'1\' respectively.\n-> After that we just need to find the min flips required, if we flip `s[0:i]` and append them at the end.\n\n**DO UPVOTE if you find it helpful!!**\n\n```\nint minFlips(string s) {\n        int n = s.length();\n        int odd[n + 1];\n        int even[n + 1];\n        odd[0] = 0;\n        even[0] = 0;\n        for(int i = 0; i < n; i++){\n            if (i % 2 != 0){\n                odd[i + 1] = odd[i] + (s[i] == \'1\');\n                even[i + 1] = even[i] +(s[i] == \'0\');\n            }else{\n                odd[i + 1] = odd[i] +(s[i] == \'0\' );\n                even[i + 1] = even[i] + (s[i] == \'1\');\n            }\n        }\n        int res = min(odd[n], even[n]);\n        for(int i = 0; i < n; i++){\n            if (n % 2 != 0){\n                res = min(res,odd[n] - odd[i + 1] + even[i + 1]);\n                res = min(res, even[n] - even[i + 1] + odd[i + 1]);\n            }\n        }\n        return res;\n    }\n```
['Prefix Sum']