‹ The Blind 75 · Binary Stage 13 of 75
‹ Number of 1 Bits Missing Number ›
Dynamic programming on bits · O(n) time, O(n) space · LeetCode ↗
For every number from 0 to n, count the bits that are 1 in its binary form, and return the counts as a list.
The practice panel runs the code in your browser, so it needs JavaScript.