C++ || Bit manipulation || Easy approach
Here is my c++ code for this problem.\n\n# Complexity\n- Time complexity:O(logn)\n\n- Space complexity:O(1)\n\n# Code\n\nclass Solution {\npublic:\n    vector<i
Here is my c++ code for this problem.\n\n# Complexity\n- Time complexity:$$O(logn)$$\n\n- Space complexity:$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> evenOddBit(int n) {\n        int e=0, o=0, cnt=0;\n        while(n>0){\n            if(cnt%2==0){\n                if(n&1){\n                    e++;\n                }\n                n=n>>1;\n            }\n            else{\n                if(n&1){\n                    o++;\n                }\n                n=n>>1;\n            }\n            cnt++;\n        }\n        return {e, o};\n    }\n};\n```
['Bit Manipulation', 'C++']