Restore IP Addresses solution || C++ solution using recursion and backtracking
Restore IP Addresses Description: A valid IP address contains four integers separated by a dot. so in total, there are three dots. Also, each integer must be in between [0,255] and any integer should not be starting with a zero. Approach Using recursion, we will select strings of lengths 1,2, and 3 and check whether they are valid or not. If the validity holds true till the size of the given string then we will store our generated string. C++ Program: vector < string > restoreIpAddresses ( string s ) { vector<string>ans; helper (s, 0 , 0 , "" ,ans); return ans; } void helper ( string s , int i , int p , string str , vector < string > & ans ){ if (i== s . size () or p== 4 ){ if (i== s . size () and p== 4 ) ans . push_back ( str . substr ( 0 ,...