Question
Given an integerÂ
n
, return an arrayÂans
 of lengthÂn + 1
 such that for eachÂi
 (0 <= i <= n
),Âans[i]
 is the number ofÂ1
’s in the binary representation ofÂi
.
This is abit_manip question.
Idea
- Use Leetcode - Number of 1 Bits to get the hamming weight of each value
- Append the output of the hamming weight function to an array lol