2 simple solutions with bit manipulation and strings
Intuition\n Describe your first thoughts on how to solve this problem. \nCheck if number a OR b needs flipping to be c bit by bit\n## 1. Bitwise solution\n\n###
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCheck if number `a` OR `b` needs flipping to be `c` bit by bit\n## 1. Bitwise solution\n\n### Approach\n<!-- Describe your approach to solving the problem. -->\nHave a number with only one bit 1, and move the bit to see if flipping is required by checking its AND result with all the numbers\n### Complexity\n- Time complexity: O(n)\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```\nfunction minFlips(a: number, b: number, c: number): number {\n    const limit = Math.max(a, b, c);\n    let check = 1;\n    let result = 0;\n    while(check <= limit){\n        if(check & c){\n            if(!(check & a) && !(check & b)){\n                result++;\n            }\n        }else{\n            if(check & a){\n                result++;\n            }\n            if(check & b){\n                result++;\n            }\n        }\n        check *= 2;\n    }\n    return result;\n};\n```\n## 2. toString solution\n### Approach\n<!-- Describe your approach to solving the problem. -->\nTransform numbers to strings and check if flipping is required through iteration\n\n### Complexity\n- Time complexity: O(n)\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```\nfunction minFlips(a: number, b: number, c: number): number {\n    const aStr = a.toString(2).split(\'\').reverse();\n    const bStr = b.toString(2).split(\'\').reverse();\n    const target = c.toString(2).split(\'\').reverse();\n\n    let result = 0;\n    const maxLen = Math.max(aStr.length, bStr.length, target.length);\n    for(let i = 0;i < maxLen; i++){\n        if(!target[i] || target[i] === \'0\'){\n            if(aStr[i] === \'1\'){\n                result++;\n            }\n            if(bStr[i] === \'1\'){\n                result++;\n            }\n        }else{\n            if((!aStr[i] || aStr[i] === \'0\') && (!bStr[i] || bStr[i] === \'0\')){\n                result++;\n            }\n        }\n    }\n    return result;\n};\n```
['Bit Manipulation', 'TypeScript', 'JavaScript']