leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0191.cpp (166B)
0 class Solution {
1 public:
2 int hammingWeight(uint32_t n) {
3 int res = 0;
4 while (n)
5 res += n & 1, n >>= 1;
6 return res;
7 }
8 };