09-01 leetcode-0338
简单题,直接写
题目:
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.
题解
这题很简单,记录2^n和非 2^n 的数的 1 的个数即可
1 | class Solution: |
Comments