#3370

Smallest Number With All Set Bits

easy · 80.4% accepted · 369 likes · top 92%

math · bit manipulation

⊣ practice⊣ open on leetcode ↗

Description

You are given a positive number n.

Return the smallest number x greater than or equal to n, such that the binary representation of x contains only set bits

Solution