One-Liners
Two solutions in case you do not want bit manipulations...\n\nC++\ncpp\nint smallestNumber(int n) {\n    return pow(2, floor(log2(n) + 1)) - 1;\n}\n\nC++\ncpp\n
Two solutions in case you do not want bit manipulations...\n\n**C++**\n```cpp\nint smallestNumber(int n) {\n    return pow(2, floor(log2(n) + 1)) - 1;\n}\n```\n**C++**\n```cpp\nint sb[10] = {1, 3, 7, 15, 31, 63, 127, 255, 511, 1023};\nint smallestNumber(int n) {\n    return *lower_bound(begin(sb), end(sb), n);\n}\n```
[]