Is this O(N) time?


#1
int Solution::hammingDistance(const vector<int> &A) {
    unsigned long long sum = 0;
    size_t len = A.size();
    unsigned count[32] = {0};
    unsigned j;
    for (int i : A) {
        unsigned x = unsigned(i);
        for (j = 0; x != 0; j++, x >>= 1)
            count[j] += x & 1;
    }
    for (j = 0; j < 32; j++)
        sum += 2 * count[j] * (len - count[j]);
    return sum % 1000000007; // Why mod 1000000007?
}