Counting Bits Leetcode


Runtime: 791 ms

We should divide it into even number and odd number,

if the number is odd, then number of ones = ones of previous number + 1
if it's even number then the number of ones = number of ones of this number shift to right by 1, which is already known







评论

此博客中的热门博文

Embedded System interview Question

MicroKernel & Exokernel 操作系统未来可能的发展

中国城市房地产分析