• + 0 comments

    C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )

    long int sumXor(long int _num) {
        size_t satisfies = 0;
        while(_num){
            satisfies += _num % 2 == 0 ? 1 : 0;
            _num /= 2;
        }
        return std::pow(2, satisfies);
    }