C++ Bit Manipulation
Code

# Code
```cpp []
class Solution {
public:
    int minChanges(int n, int k) {
        int c = n^k, ans = 0;
        while (c > 0) {
            if (c % 2) {
                if (k % 2 == 0) {
                    ans++;
                } else return -1;
            }
            c /= 2;
            k /= 2;
        }
        return ans;
    }
};
```
['C++']