C++ beginner friendly :
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nCheck if transformation is possible:\n\n- We use (n & k) != k to determin
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n**Check if transformation is possible:**\n\n- We use (n & k) != k to determine if there is any bit in k that is 1 while the corresponding bit in n is 0. If this condition is true, then it is impossible to transform n into k using only the allowed bit changes, and we return -1.\n\n**Count the required changes:**\n\n- We initialize changes to 0 and then iterate through each bit of n and k.\n- For each bit position, we compare the least significant bits of n and k using (n & 1) and (k & 1).\n- If they differ, we increment changes.\n- We then right-shift both n and k to process the next bit.\n\n**Output the result:**\n\n- Finally, the function returns the total number of changes needed.\n\n\n# Code\n```\nclass Solution {\npublic:\n    int minChanges(int n, int k) {\n         if ((n & k) != k) {\n        return -1;\n    }\n\n    int changes = 0;\n    while (n > 0) {\n        \n        if ((n & 1) != (k & 1)) {\n            changes++;\n        }\n        \n        n >>= 1;\n        k >>= 1;\n    }\n\n    return changes;\n    }\n};\n```
['C++']