2023-09-01 06:55:13 +0000 UTC

Counting Bits

Code

class Solution:
    def countBits(self, n: int) -> List[int]:
        return tuple(bin(i).count("1") for i in range(n + 1))