题解 | #整数转化#
整数转化
http://www.nowcoder.com/practice/c7df20a5a39e4357aecc1071e7fd523c
# -*- coding:utf-8 -*-
class Transform:
def calcCost(self, A, B):
# write code here
temp = A ^ B
counter = 0
while temp > 0:
if temp & 1 == 1:
counter += 1
temp >>= 1
return counter

查看22道真题和解析