EASIEST 2 LINE SOLUTION BEATING 100% IN 0ms
ApproachTo find the smallest number x greater than or equal to n where x's binary representation consists of only set bits (i.e., all bits are 1), we can utiliz
# Approach
<!-- Describe your approach to solving the problem. -->
To find the smallest number x greater than or equal to n where x's binary representation consists of only set bits (i.e., all bits are 1), we can utilize the following method:
1. Start with a number of the form 2^k - 1, which in binary is k consecutive set bits (e.g., 3 (11), 7 (111), 15 (1111), etc.).
2. Keep increasing k until 2^k - 1 is greater than or equal to n.
3. Return this number.
# Complexity
- Time complexity: O(log n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

![image.png](https://assets.leetcode.com/users/images/ea6fbf1d-8c77-4584-bd4a-8a58b7e461e9_1739086453.8204598.png)

# Code
```java []
class Solution {
    public int smallestNumber(int n) {
        int x = 1;
        while ((x - 1) < n) {
            x <<= 1;  // Multiply x by 2
        }
        return x - 1;
    }
}
```
['Math', 'Bit Manipulation', 'Java']