minChanges: easy solution. BEAT 100% ✅
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nSimply extract one bit at a time from the two numbers.\nif bit_n is 1 and
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nSimply extract one bit at a time from the two numbers.\nif bit_n is 1 and bit_k is 0, we increment by one the number of changes. if bit_n is 0 and bit_k is 1, return -1 because it is not possible to make n equal to k.\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n```c []\nint minChanges(int n, int k) {\n    int bit_n;\n    int bit_k;\n    int number_of_changes=0;\n    for(int i=20;i>=0;i--){\n        bit_n=(n >> i) & 1;\n        bit_k=(k >> i) & 1;\n        if(bit_n && !bit_k) number_of_changes++;\n        else if(!bit_n && bit_k) return -1;\n    }\n    return number_of_changes;\n}\n```
['Bit Manipulation', 'C']