Sakura

sakura

博客园 首页 新随笔 联系 订阅 管理

给定两个整数AB。编写函数,返回将整数A转变成整数B所需要改变的数位个数。

 

import java.util.*;

public class Transform {
    public int calcCost(int A, int B) {
        // write code here
        return Integer.bitCount( A^B);
    }
}

 

posted on 2020-10-29 14:23  .geek  阅读(300)  评论(0编辑  收藏  举报