https://leetcode.com/problems/minimum-bit-flips-to-convert-number
2220. Minimum Bit Flips to Convert Number
位元翻转 (bit flip) 是数的二进制表示中 将其中一个位元从 0 转 1 或 1 转 0
给一个 start 求位元翻转成 goal 最少要花的次数
Example 1:
  Input: start = 10, goal = 7
  Output: 3
  Explanation: 10 跟 7 分别是 1010 和 0111 要翻转的有 1, 3, 4 个位子 答案 3
Example 2:
  Input: start = 3, goal = 4
  Output: 3
  Explanation: 3 跟 4 分别是 011 和 100 三个位子都要翻转 答案 3
思路:照做
※ 引述《DJYOMIYAHINA (通通打死)》之铭言:
: 早早早早早
: 一二三四五
: def minBitFlips(self, start: int, goal: int) -> int:
:     ans = 0
:     x = start^goal
:     while x>0:
:         ans += (x&1)
:         x = x >> 1
:     return ans
Python Code:
class Solution:
    def minBitFlips(self, start: int, goal: int) -> int:
        return bin(start ^ goal).count('1')
好短