← ALL NOTES
Math

3370. Smallest Number With All Set Bits

Given a positive n. Find the smallest number x ≥ n whose binary representation has all bits set (i.e. x is of the form 2^k − 1: 1, 3, 7, 15, …).

Loading…