Beats 100% | Easy to Understand | Explained | Optimal Solution (●'◡'●) 🧨🧋
Intuition\nBitwise Operations: The algorithm uses bitwise operations to check each bit of a 32-bit integer. For each bit position, it determines if that bit is 
# Intuition\nBitwise Operations: The algorithm uses bitwise operations to check each bit of a 32-bit integer. For each bit position, it determines if that bit is set (i.e., equal to 1).\nLoop Through Bits: The loop iterates from 0 to 31, covering all 32 bits of the integer.\nBit Checking: For each bit position i, n & (1 << i) creates a mask where only the i-th bit of n is checked. If this result is non-zero, the i-th bit is set.\nEven/Odd Position Check: The index i is checked to determine if it is even or odd, and the counts are updated accordingly.\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n```java []\nclass Solution {\n    public int[] evenOddBit(int n) {\n        int[] res=new int[2];\n        for(int i=0;i<32;i++){\n        if ((n & (1 << i)) != 0) {\n            if(i%2==0) res[0]+=1;\n            else res[1]+=1;\n            }\n        }\n        return res;\n    }\n}\n\n```\n```python3 []\nclass Solution:\n    def evenOddBit(self, n: int) -> List[int]:\n        res=[0,0]\n        for i in range(32):\n            if n & (1<<i):\n                if(i%2==0):\n                    res[0]+=1\n                else:\n                    res[1]+=1\n        return res\n```\n\n
['Java', 'Python3']