add new solutions
This commit is contained in:
parent
9a10695e8c
commit
ca24d0a56a
30 changed files with 697 additions and 16 deletions
11
solutions/3/q338/solution.go
Normal file
11
solutions/3/q338/solution.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package q338
|
||||
|
||||
func countBits(n int) []int {
|
||||
ret := make([]int, n+1)
|
||||
for i := 1; i <= n; i++ {
|
||||
ret[i] = ret[i>>1] + i%2
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
var _ = countBits
|
||||
Loading…
Add table
Add a link
Reference in a new issue