s4553711
9/17/2017 - 3:22 PM

191.cpp

class Solution {
public:
    int hammingWeight(uint32_t n) {
        int result = 0;
        while (n != 0) {
            n &= (n - 1);
            ++result;
        }
        return result;
    }
};