One-liner explained
Xor operation ^ is an "inequality testing" operator, i.e. if we want to test whether x $\neq $ y (bitwise speaking), we use x ^ y which yields 1 for non-equal a
Xor operation **^** is an "inequality testing" operator, i.e. if we want to test whether **x $\\neq $ y** (bitwise speaking), we use **x ^ y** which yields 1 for non-equal and 0 for equal.\nSo, here we test values **a | b** vs **c**\n**(a | b) ^ c** gives almost what we need, except for the nasty case of **a = 1, b = 1, c = 0** when it takes not one but two flips to change the outcome of **a | b**. So we just add 1 to the result for that case, that\'s where **a & b & ~c** comes from.\nThe resulting formula provides the desired answer for any triple of corresponding bits from a, b, and c. And to get the result for the whole number, use the property with self-explanatory name `nonzeroBitCount` (or its equivalent in your language of choice).\n\n```\nfunc minFlips(_ a: Int, _ b: Int, _ c: Int) -> Int {\n    ((a | b) ^ c).nonzeroBitCount + (a & b & ~c).nonzeroBitCount\n}\n```\n![1.JPG](https://assets.leetcode.com/users/images/55291529-cc37-4f00-915f-de3cfee6f4cb_1686098366.8057234.jpeg)\n![2.JPG](https://assets.leetcode.com/users/images/3154e848-ac97-416b-a655-9cc34ae88df0_1686098399.302026.jpeg)\n
['Bit Manipulation', 'Swift']