Search
⌘K

Leetcode 3370. Smallest Number With All Set Bits

Find the smallest integer x ≥ n whose binary representation is all 1s (i.e., x = 2^k − 1 for some k). In other words, determine the minimal k such that 2^k − 1 ≥ n.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.