题解 | 整数转化
整数转化
https://www.nowcoder.com/practice/c7df20a5a39e4357aecc1071e7fd523c
# -*- coding:utf-8 -*-
class Transform:
def calcCost(self, A, B):
# write code here
a = A ^ B
count = 0
while a:
a &= (a-1)
count += 1
return count
查看20道真题和解析