0ms C++ | Bit shift operator, straightforward logic
Intuition & ApproachIf n is greater than k we may be able do bit changes (1 to 0) to get k. So we compare the bits of both numbers and run a counter c.Complexit
# Intuition & Approach

If `n` is greater than `k` we may be able do bit changes (1 to 0) to get `k`. So we compare the bits of both numbers and run a counter `c`.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minChanges(int n, int k) {
        if (n == k)
            return 0;
        if (k > n)
            return -1;

        int c = 0, b = 0;

        // Checking bits from the right
        while (b < 32) {
            if (((n >> b) & 1) == 1 && ((k >> b) & 1) == 0)
                c++;
            else if (((n >> b) & 1) == 0 && ((k >> b) & 1) == 1)
                return -1;
            b++;
        }

        return c;
    }
};
```
['Bit Manipulation', 'C++']