给定两个整数A和B。编写函数,返回将整数A转变成整数B所需要改变的数位个数。
import java.util.*; public class Transform { public int calcCost(int A, int B) { // write code here return Integer.bitCount( A^B); } }
Powered by: 博客园 Copyright © 2024 .geek Powered by .NET 9.0 on Kubernetes