首页 > 其他 > 详细

神一样的代码:

时间:2015-11-19 14:26:27      阅读:144      评论:0      收藏:0      [点我收藏+]
public static int singleNumber(int[] nums) {
int once = 0;
int twice = 0;
for (int i = 0; i < nums.length; i++) {
twice |= once & nums[i];
once ^= nums[i];
int not_three = ~(once & twice);
once = not_three & once;
twice = not_three & twice;
}
return once;
}

神一样的代码:

原文:http://www.cnblogs.com/qinyongzhu/p/4977258.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!