[C++] Concise solution using bit manipulation
Complexity\n- Time complexity: O(1)\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# Co
# Complexity\n- Time complexity: $$O(1)$$\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``` cpp []\nclass Solution {\npublic:\n    int minChanges(int n, int k) {\n        if ((n & ~k) == (n ^ k)) return __builtin_popcount(n ^ k);\n        return -1;\n    }\n};\n```
['Bit Manipulation', 'C++']