Simple and easy to understand approach.
Intuition\n Describe your first thoughts on how to solve this problem. \nJust create binary string of the given number and count set bits at even and odd places
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nJust create binary string of the given number and count set bits at even and odd places.\n\n# Code\n``` C++ []\nclass Solution {\npublic:\n    \n    string bina(long n)\n  {\n    long i;\n        string r;\n    cout << "0";\n    for (i = 1 << 30; i > 0; i = i / 2)\n    {\n      if((n & i) != 0)\n      {\n        r += "1";\n      }\n      else\n      {\n        r += "0";\n      }\n    }\n        return r;\n  }\n    \n    vector<int> evenOddBit(int n) {\n        string bin = bina(n);\n        int even = 0, odd = 0;\n        for(int i=0; i<bin.size(); i++)\n        {\n            if((i%2)==1 && bin[i]==\'1\')odd++;\n            if((i%2)==0 && bin[i]==\'1\')even++;\n        }\n        vector<int> res = {even, odd};\n        return res;\n    }\n};\n```\n\n```java []\nclass Solution {\n    \n    String bina(long n) {\n        StringBuilder r = new StringBuilder();\n        for (long i = 1L << 30; i > 0; i = i / 2) {\n            if ((n & i) != 0) {\n                r.append("1");\n            } else {\n                r.append("0");\n            }\n        }\n        return r.toString();\n    }\n    \n    public List<Integer> evenOddBit(int n) {\n        String bin = bina(n);\n        int even = 0, odd = 0;\n        for (int i = 0; i < bin.length(); i++) {\n            if ((i % 2) == 1 && bin.charAt(i) == \'1\') {\n                odd++;\n            }\n            if ((i % 2) == 0 && bin.charAt(i) == \'1\') {\n                even++;\n            }\n        }\n        List<Integer> res = new ArrayList<>();\n        res.add(even);\n        res.add(odd);\n        return res;\n    }\n}\n```\n```python3 []\nclass Solution:\n    \n    def bina(self, n: int) -> str:\n        r = ""\n        for i in range(30, -1, -1):\n            if (n & (1 << i)) != 0:\n                r += "1"\n            else:\n                r += "0"\n        return r\n    \n    def evenOddBit(self, n: int) -> List[int]:\n        bin_str = self.bina(n)\n        even = odd = 0\n        for i in range(len(bin_str)):\n            if i % 2 == 1 and bin_str[i] == \'1\':\n                odd += 1\n            if i % 2 == 0 and bin_str[i] == \'1\':\n                even += 1\n        return [even, odd]\n```\n
['C++', 'Java', 'Python3']