// ONE LINER SOLUTION >- BEATS 100% 
🧠 Intuition
The goal is to find a pattern related to the highest power of 2 in the given number n. Observing the binary representation of numbers, we notice tha
🧠 Intuition
The goal is to find a pattern related to the highest power of 2 in the given number n. Observing the binary representation of numbers, we notice that:

The highest power of 2 in n is the most significant set bit.
If we take 2 * highestOneBit(n) - 1, we get a number consisting of all 1s in binary, covering that power of 2.
For example:

n = 5 (binary 101), highest power of 2 = 4 (binary 100), result = 7 (binary 111).
n = 10 (binary 1010), highest power of 2 = 16 (binary 1000), result = 15 (binary 1111).
🔍 Approach
Find the highest power of 2 in n using Integer.highestOneBit(n).
Generate a number with all 1s up to that position using 2 * highestOneBit(n) - 1.
Return the computed result.
⏳ Complexity Analysis
Time Complexity: 
O(1)
Integer.highestOneBit(n) runs in constant time as it operates on a fixed 32-bit integer.
Space Complexity: 
O(1)
No extra space is used.
💻 Code
java: 
class Solution {
    public int smallestNumber(int n) {
        int nextPower = Integer.highestOneBit(n);
        return 2 * nextPower - 1;
    }
}
['Java']