public int changeNumber (int num) { // write code here int count = 0; int res = 0; for(int i = 0; i <= 32; i++) { int m = 1 << i; if((m & num) == 0) { count++; } if(count == 2) { res = m ^ num; break; } } return res; }
1 1

相关推荐

07-03 16:02
门头沟学院 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务