cjql / algorithm

https://cjql.github.io/algorithm/
1 stars 1 forks source link

LeetCode_Dynamic: https://leetcode.com/problems/counting-bits/submissions/ #5

Open cjql opened 4 years ago

cjql commented 4 years ago

C++

Java

Python

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

C

JavaScript

Ruby

Swift

Go

Scala

Kotlin

Rust

PHP