Convert String to integer in Any base and vise versa

Learnings

Intuition

0110 in string

int n = stoi(str, Start_index, Base)
n=6 


ALso number to binary
n=6


Bitset
bitset<size> variable_name;
bitset<size> variable_name(Decimal/String);

We can directly use this also

n=6
string s = bitset<16>(nums[i]). to_string;

https://www.geeksforgeeks.org/cpp-bitset-and-its-application/

https://leetcode.com/problems/find-unique-binary-string/

Last updated