#3370

Smallest Number With All Set Bits

newbie · 175 · lc easy +15 · 80.4% accepted · 369 likes · top 92%

Description

You are given a positive integer n.

Return the smallest integer x that is greater than or equal to n and whose binary representation consists entirely of 1-bits.

Code

1
2
3