💯 8 lines C++ | Easy | Bit-Manipulation
Please upvote if you liked this post\n\n# Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your
### Please upvote if you liked this post\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> evenOddBit(int n) {\n        int even = 0, odd = 0;\n        for(int i = 10; i>=0; i--){\n            int bit = (n >> i) & 1;\n            if(i%2 == 0 && bit)\n                even++;\n            if(i%2 != 0 && bit)\n                odd++;\n        }\n        \n        return {even, odd};\n    }\n};\n```
['Bit Manipulation', 'C++']