标签:
1 class Solution { 2 public: 3 int hammingWeight(uint32_t n) { 4 int count = 0; 5 while (n) { 6 if (n & 1) ++ count; 7 n >>= 1; 8 } 9 return count; 10 } 11 };
191. Number of 1 Bits
原文地址:http://www.cnblogs.com/shadowwalker9/p/5745898.html