Quantcast
Channel: March 2015 – Program Creek
Viewing all articles
Browse latest Browse all 6

LeetCode – Counting Bits (Java)

$
0
0
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example: For num = 5 you should return [0,1,1,2,1,2]. 1. Naive Solution We can simply count bits for each number like ... Read more

Viewing all articles
Browse latest Browse all 6

Trending Articles