BEATS 100% WITH 3 LINES OF CODE
IntuitionApproachFirst find the number of bits in the number and then return the 2 raise to the power bits -1. If you find any difficulty please refer to my sol
# Intuition


# Approach
 First find the number of bits in the number and then return the 2 raise to the power bits -1. If you find any difficulty please refer to my solution.

# Complexity
- Time complexity:  O(1).


- Space complexity:  O(1).

# Code
```java []
class Solution {
    public int smallestNumber(int n) {
      int bits = (int) (Math.log(n)/Math.log(2.0));
      int x =(int)(Math.pow(2,bits+1));
      return x -1;
    }
}
```
['Math', 'Bit Manipulation', 'Java']