3226. Number of Bit Changes to Make Two Integers Equal
Intuition\n Describe your first thoughts on how to solve this problem. \nEasy one, if you are good at bit manipulation!\n# Approach\n Describe your approach to 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nEasy one, if you are good at bit manipulation!\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBit Manipulation => Checking if i\'th bit of \'n\' is set(1) && i\'th bit of \'k\' is unset(0) -> toggle i\'th bit of \'n\' using XOR(^) -> after altering all bits, if "n==k" return count of toggles, otherwise return -1.\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int minChanges(int n, int k) {\n        int c = 0;\n        for(int i=0;i<32;++i)\n        {\n            if(((n & (1<<i)) > 0) && ((k & (1<<i)) == 0 ))\n            {\n                n = (n^(1<<i));\n                c++;\n            }\n        }\n        if(n==k)\n            return c;\n        return -1;\n    }\n}\n```
['Java']