Fast and Efficient Python Solution Beats 100% 🔥🔥
IntuitionI immediately thought of converting both numbers into binary, and proceeding from there.ApproachSimply checking all i where n[i] = 1 and k[i] = 0 is a
# Intuition
I immediately thought of converting both numbers into binary, and proceeding from there.

# Approach
Simply checking all i where n[i] = 1 and k[i] = 0 is a perfectly valid and efficient solution. For all i that meet this condition, it suffices to increment the answer by 1 and set n[i] = 0. But this approach doesn't cover the case where the len(n) != len(k). If this is the case, just add their absolute difference number of zeroes to the shorter length number, which would yield in them being the same length.

# Complexity
- Time complexity:
$$O(n)$$

- Space complexity:
$$O(n)$$

# Code
```python3 []
class Solution:
    def minChanges(self, n: int, k: int) -> int:
        bn = " ".join(str(bin(n)).replace("0b", "")).split()
        kn = " ".join(str(bin(k)).replace("0b", "")).split()
        if len(bn) < len(kn):
            bn = ["0"] * (len(kn) - len(bn)) + bn
        elif len(kn) < len(bn):
            kn = ["0"] * (len(bn) - len(kn)) + kn

        ans = 0
        for i in range(len(bn)):
            if bn[i] == "1" and kn[i] == "0":
                ans += 1
                bn[i] = "0"
        
        return ans if bn == kn else -1
        
```
['Python3']