We’re preparing your current view and syncing the latest data.
Given a non-negative integer num, return an array of length num + 1 where each element i is the number of 1's in the binary representation of i. For example, given num = 5, return [0,1,1,2,1,2] because 0 in binary has zero '1's, 1 has one '1', 2 has one '1', 3 has two '1's, 4 has one '1', and 5 has two '1's.
An integer num where 0 <= num <= 10^5.
An integer array ans of length num + 1 where ans[i] is the number of 1's in the binary representation of i.
0 <= num <= 10^5