Amazing Approach || BEATS 100%👍
We need to check the no. of bits in even places and odd places in the given no.\nWe can achieve this by having a number that has all of its odd place bits ON on
We need to check the no. of bits in even places and odd places in the given no.\nWe can achieve this by having a number that has all of its odd place bits ON only and having another number that has all of its even bits ON only.\nThen we can use bitwise operator & (and) between the given number and the 2 nos. created .\noutput of (and) will give us 2 nos. one of which will contain the no. of bits on at even place and the other will Odd ones.\n\nThen we just need to return the result after pushing it into the vector.\n\n# Complexity\n- Time complexity: O( no. of bits )\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 x) {\n    std::vector<int> vec;\n    int z = 0xAAAAAAAA; \n    int y = 0x55555555;\n    vec.push_back(__builtin_popcount(x & y));  \n    vec.push_back(__builtin_popcount(x & z)); \n    \n    return vec;\n    }\n};\n```
['Bit Manipulation', 'C++']