#191

Number of 1 Bits

easy · 76.4% accepted · 7,154 likes · top 87%

divide and conquer · bit manipulation

⊣ practice⊣ quiz⊣ open on leetcode ↗

Description

Given a positive integer n, write a function that returns the number of set bits in its binary representation (also known as the Hamming weight).

Solution