simple and easy C++ solution | Bitmask
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n###### Let\'s Connect on Linkedin: www.linkedin.com/in/shishirrsiam\n\n\n\n# Code\ncpp []\nclass Solutio
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n###### Let\'s Connect on Linkedin: www.linkedin.com/in/shishirrsiam\n\n\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int smallestNumber(int n) \n    {\n        bitset<24>bits(n);\n        string num, s = bits.to_string();\n\n        int idx = s.find(\'1\');\n        for(int i = idx; i < 24; i++)\n            num += \'1\';\n\n        int ans = stoi(num, NULL, 2);\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'Bitmask', 'C++']