2220. Minimum Bit Flips to Convert Number ¶ Time: $O(\log (\max(\texttt{start}, \texttt{goal})))$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6class Solution { public: int minBitFlips(unsigned start, unsigned goal) { return popcount(start ^ goal); } }; 1 2 3 4 5class Solution { public int minBitFlips(int start, int goal) { return Integer.bitCount(start ^ goal); } } 1 2 3class Solution: def minBitFlips(self, start: int, goal: int) -> int: return (start ^ goal).bit_count()