C++ beats 100% Time and space
Intuition\nIterating through binary representation, and keeping track of current bit count. \n\n# Approach\nInterate through the binary representation of the nu
# Intuition\nIterating through binary representation, and keeping track of current bit count. \n\n# Approach\nInterate through the binary representation of the number , `bit` denotes the current bit number we are accessing, if the bit is `1` as per the parity of `bit` increment `even` or `odd`.\n\n# Complexity\n- Time complexity: O(log 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 odd = 0, even = 0, bit = 0;\n        while (n > 0) {\n            (n % 2 == 1 ? (bit % 2 == 0 ? even++ : odd++) : true);\n            bit++;\n            n /= 2;\n        }         \n        return { even , odd };   \n    }\n};\n```
['C++']