i am having problem in solving problems with recursion,
i know, right now i am printing it backwards…
here is my code
#include
#include
using namespace std;
void MappedString(int n,int j,char ans[],char list[]){
if(n==0){
cout<<ans<<endl ;
return;
}
int t1=n%10;
ans[j]=list[t1-1];
MappedString(n/10,j+1,ans,list);
int t2=n%100;
if(t2>26 || t2<=9){
return;
}
else{
ans[j]=list[t2-1];
MappedString(n/100,j+1,ans,list);
}
}
int main() {
int n;
cin>>n;
char list[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char ans[1000001];
MappedString(n,0,ans,list);
}