面试题 05.06. 整数转换
题目:
解答:
class Solution { public: int convertInteger(int A, int B) { int res = 0; int temp = A ^ B; while (temp!=0) { int lowbit = temp & (-temp); res++; temp-=lowbit; } return res; } };
题目:
解答:
class Solution { public: int convertInteger(int A, int B) { int res = 0; int temp = A ^ B; while (temp!=0) { int lowbit = temp & (-temp); res++; temp-=lowbit; } return res; } };