<2017年9月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

统计

  • 随笔 - 57
  • 文章 - 7
  • 评论 - 0
  • 引用 - 0

常用链接

留言簿

随笔分类

随笔档案

文章分类

文章档案

Blog

Coder 必备技巧

Compiler for Wurq

搜索

  •  

最新评论

阅读排行榜

评论排行榜

【LeeCode 2017/06/15】 476. Number Complement
 1 class Solution {
 2 public:
 3     int findComplement(int num) {
 4         int sum = 0;
 5         int n = 1;
 6         while (num){
 7             sum += ((num & 1^ 1)*n;
 8             num >>= 1;
 9             n *= 2;
10         }
11         return sum;
12     }
13 };

posted on 2017-06-13 10:58 Wurq 阅读(98) 评论(0)  编辑 收藏 引用 所属分类: 【LeeCode 每日N题】