Advertisement
Josif_tepe

Untitled

Dec 30th, 2022
938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     vector<int> countBits(int n) {
  4.         vector<int> result;
  5.         for(int i = 0; i <= n; i++) {
  6.             result.push_back(__builtin_popcount(i));
  7.         }
  8.         return result;
  9.  
  10.     }
  11. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement