• + 0 comments
    /*
     * Complete the 'sumXor' function below.
     *
     * The function is expected to return a LONG_INTEGER.
     * The function accepts LONG_INTEGER n as parameter.
     */
    
    long sumXor(long n) {
        long count = 0;
        auto s = bitset<64>(n).to_string();
        auto t = s.find_first_of("1");
        for (size_t i = t+1; i < 64; ++i) {
            if (s[i] == '0') { count++; }
        }    
        // cout << count << endl;
        return 1L << count;
    }