3,5
2
3的二进制为11,5的二进制为101,总共有2位不同
1999,2299
7
# 通过异或运算得出不同位数,在进行统计 class Solution: def countBitDiff(self , m: int, n: int) -> int: # write code here c = bin(m^n).count('1') return c
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题