Bit manipulation | beats 100% | O(1)
IntuitionWe are given two integers n and k. We need to find the minimum number of bits to flip in n so that it becomes a superset of k in binary (i.e., all bits
# Intuition
We are given two integers `n` and `k`. We need to find the **minimum number of bits to flip in `n`** so that it becomes a **superset of `k` in binary** (i.e., all bits that are set in `k` must also be set in `n`).  
If `k` has a bit set that is not set in `n`, then it's **impossible** to transform `n` into such a number without setting that bit — and if we're only allowed to flip bits in `n`, not increase the length or use additional tricks, we should return -1 in that case.

# Approach
- First, check if `n` is a **bitwise superset** of `k` using `(n | k) == n`.  
  - If not, it's impossible to convert `n` to `k` by only flipping bits — return -1.
- If `n` is a superset of `k`, then count how many bits are **extra in `n`** that are not present in `k`.
  - Use `Integer.bitCount(n)` to count how many bits are set in `n`.
  - Use `Integer.bitCount(k)` to count how many bits are needed to be set in `k`.
  - The difference is the number of **extra bits that should be turned off** in `n` to match `k`.

# Complexity
- Time complexity:  
  $$O(1)$$ — Bitwise operations and `Integer.bitCount` are constant time for fixed-width integers.

- Space complexity:  
  $$O(1)$$ — No extra space used.

# Code
```java
class Solution {
    public int minChanges(int n, int k) {
        if ((n | k) != n) return -1;
        return Integer.bitCount(n) - Integer.bitCount(k);
    }
}

['Java']