3370. Smallest Number With All Set Bits
Complexity
Time complexity: O(n)

Space complexity: O(1)
Code
# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```python []
class Solution(object):
    def smallestNumber(self, n):
        """
        :type n: int
        :rtype: int
        """
        if n==1:
            return 1
        for i in range(n):
            if (2**i)-1>=n:
                return (2**i)-1
```
['Python']