Open cjql opened 4 years ago
class Solution: def countBits(self, num: int) -> List[int]: res = [0] for i in range(1,num+1): res.append(res[i>>1]+(i&1)) return res
C++
Java
Python
C
C
JavaScript
Ruby
Swift
Go
Scala
Kotlin
Rust
PHP