Skip to content

#338 - Counting Bits

EasyBit Manipulation
Open on LeetCode

Given an integer n, return an array ans of length n + 1 such that ans[i] is the number of 1's in the binary representation of i.

InputOutput
n = 2[0,1,1]
n = 5[0,1,1,2,1,2]

Released under the MIT License.