Beats 100% || 8 Line Code || Detailed Explaination🏆
Intuition\n Describe your first thoughts on how to solve this problem. \nBit Manipulation:\nYou can change any bit in n that is 1 to 0.\n\n\nTransform n into k 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nBit Manipulation:\nYou can change any bit in n that is 1 to 0.\n\n\nTransform n into k by making the minimum number of such changes.\nIf any bit in k is 1 but the corresponding bit in n is 0, it is impossible to achieve the transformation (since you cannot turn 0 into 1).\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBit Comparison:\nIterate through each bit position (0 to 31, assuming 32-bit integers).\nCheck if the bit in k is 1 but the corresponding bit in n is 0. If so, return -1 because it is impossible to transform n into k.\nCheck if the bit in n is 1 but the corresponding bit in k is 0. If so, increment the change counter.\nDetailed Explanation with Code\nInitialization:\n\ncnt to store the number of changes needed.\nIterate through Bits:\n\nUse a loop to iterate through each bit position from 0 to 31.\nUse bitwise operations to check and compare the bits in n and k.\nCheck Conditions:\n\nIf k has a 1 where n has a 0, return -1.\nIf n has a 1 where k has a 0, increment the change counter.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(32)=O(1)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\nLearn more about BIT MANIPULATION to solve this kind of problems,\nyou can learn more about bit manipulation on striver\'s channel in 1-2 hours!\n\nDO GIVE AN UPVOTE IF YOU GAINED KNOWLEDGE\n\n# Code\n```\nclass Solution {\npublic:\n    int minChanges(int n, int k) {\n        int cnt=0;\n        for(int i=0;i<32;i++){\n            if((k&1<<i)&&(!(n&1<<i)))return -1;\n            if((!(k&1<<i))&&(n&1<<i))cnt++;\n        }\n        return cnt;\n    }\n};\n```
['C++']