Posted on

Description

Submission

class Solution {
public:
    vector<int> countBits(int num) {
        vector<int> rets;

        for(int i = 0; i <= num; ++i) {
            rets.push_back(__builtin_popcount(i));
        }

        return rets;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *