#191

Number of 1 Bits

newbie · 230 · lc easy +17 · 76.4% accepted · 7,154 likes · top 87%

play →

Description

Given a positive integer n, return the number of set bits (1-bits) in its binary representation (also known as the Hamming weight).

Code

1
2
3