Python (Simple Maths)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minFlips(self, s):\n        n, odd, even = len(s), defaultdict(int), defaultdict(int)\n\n        for i in range(n):\n            if i%2 == 1:\n                odd[s[i]] += 1 \n            else:\n                even[s[i]] += 1 \n\n        min_val = min(odd["1"]+even["0"],odd["0"]+even["1"])\n\n        if n%2 == 0: return min_val \n\n        for i in range(n):\n            even[s[i]] -= 1 \n            odd[s[i]] += 1 \n            even, odd = odd, even \n            min_val = min(min_val,odd["1"]+even["0"],odd["0"]+even["1"])\n\n        return min_val \n```
['Python3']