2023-09-01 09:55:13 +0300 MSK

Counting Bits

Code

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