Simple O(N) solution in C
Intuition\nUse Odd and Even Hex pattern and find the bits set.\n\n# Approach\nUse Odd and Even Hex pattern and find the bits set. Extract bit count from the pat
# Intuition\nUse Odd and Even Hex pattern and find the bits set.\n\n# Approach\nUse Odd and Even Hex pattern and find the bits set. Extract bit count from the pattern\n\n# Complexity\n- Time complexity:\nO(2N)\n\n- Space complexity:\nO(2)\n\n# Code\n```\n/**\n * Note: The returned array must be malloced, assume caller calls free().\n */\nint* evenOddBit(int n, int* returnSize){\n\n    *returnSize = 2;\n\n    int evenBit =  (n & (0x55555555));\n    int oddBit =   (n & (0xAAAAAAAA));\n    int evenCount = 0;\n    int oddCount = 0;\n\n    while (evenBit)\n    {\n        if (evenBit & 0x01)\n        {\n            evenCount++;\n        }\n        evenBit = evenBit>>1;\n    }\n\n    while (oddBit)\n    {\n        if (oddBit & 0x01)\n        {\n            oddCount++;\n        }\n        oddBit = oddBit>>1;\n    }\n\n    int *arr = (int*)malloc(sizeof(int)*2);\n\n    arr[0] = evenCount;\n    arr[1] = oddCount;\n\n    return arr;\n}\n```
['C']