Java | Bit manipulation | 10 lines
Complexity\n- Time complexity: O(n) where n is the number of bits\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space compl
# Complexity\n- Time complexity: $$O(n)$$ where `n` is the number of bits\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```\nclass Solution {\n  public int minFlips(int a, int b, int c) {\n    var cnt = 0;\n\n    while (a>0 || b>0 || c>0) {\n      if ((c & 1) == 0) {\n        if ((a & 1) == 1) cnt++;\n        if ((b & 1) == 1) cnt++;\n      } else if ((a & 1) == 0 && (b & 1) == 0) cnt++;\n\n      a >>= 1;\n      b >>= 1;\n      c >>= 1;\n    }\n    return cnt;\n  }\n}\n```\nIf you like my solution, please upvote it!
['Bit Manipulation', 'Java']