From 5d74d22ca89d4111c9d773e3b242d44c7d70a630 Mon Sep 17 00:00:00 2001 From: chayan das Date: Wed, 29 Oct 2025 22:34:35 +0530 Subject: [PATCH] Create 3370. Smallest Number With All Set Bits --- 3370. Smallest Number With All Set Bits | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 3370. Smallest Number With All Set Bits diff --git a/3370. Smallest Number With All Set Bits b/3370. Smallest Number With All Set Bits new file mode 100644 index 0000000..417fc3b --- /dev/null +++ b/3370. Smallest Number With All Set Bits @@ -0,0 +1,10 @@ +class Solution { +public: + int smallestNumber(int n) { + int x = 1; + while (x < n) { + x = (x << 1) + 1; + } + return x; + } +};