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
评论