Golang | Beats 100% | Easy to understand | Simple code
Approach\nCompare these three numbers bit-by-bit. \n- ai OR bi == ci - this case means no flips are needed for ith bits.\n- ai OR bi != ci - this case means tha
# Approach\nCompare these three numbers bit-by-bit. \n- `ai OR bi == ci` - this case means no flips are needed for $$ith$$ bits.\n- `ai OR bi != ci` - this case means that there must be at least one flip operation. But actually, there is a possiblity that we need to perform two flips, when `ci` is 0 and both `ai` and `bi` are 1.\n\n# Code\n```\nfunc minFlips(a int, b int, c int) int {\n\tans := 0\n\tfor a > 0 || b > 0 || c > 0 {\n\t\tai, bi, ci := a%2, b%2, c%2\n\t\ta, b, c = a/2, b/2, c/2\n\t\tif ai|bi != ci {\n\t\t\tans++\n\t\t\tif ci == 0 && ai == 1 && bi == 1 {\n\t\t\t\tans++\n\t\t\t}\n\t\t}\n\n\t}\n\treturn ans\n}\n\n```
['Go']