In [75]: x=4 In [76]: y=1 In [77]: str(bin(x ^ y))[2:].count('1') Out[77]: 2 In [78]: 来自:https://leetcode.com 相关文章: 2021-12-20 2021-05-14 2021-08-09 2021-08-07 2022-02-27