100% faster solution && O(1) space || C++ && counting
\n# Complexity\n- Time complexity:\n  O(1)\n// upto 10 bits only\n\n- Space complexity:\n  O(1)\n\n# Code\n\nclass Solution {\npublic:\n    vector<int> evenOddB
\n# Complexity\n- Time complexity:\n  O(1)\n// upto 10 bits only\n\n- Space complexity:\n  O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> evenOddBit(int n) {\n        int index=0;\n        int even=0;\n        int odd=0;\n        while(n>0)\n        {\n            int k=n%2;\n            n/=2;\n            if(k==1)\n            {\n                if(index%2==0)\n                {\n                    even++;\n                }\n                else\n                {\n                    odd++;\n                }\n            }\n            index++;\n        }\n        return{even,odd};\n    }\n};\n```
['C++']