I HIGHLIGHT THAT I'M JUST IN PR2 AND THERE ARE MANY THINGS THAT I STILL DO NOT, APOLOGIZE MY IGNORANCE
(It has to be resolved with recursion)
Good this is my code in which I try to solve the problem of the image above, which I do not understand because in my code it only shows me two possible ways when, example using n = 3, it would have 0123,013,023. while it only shows me 0123,023. A help please, thank you
#include <iostream>
using namespace std;
void caminos (int,int);
int main(){
int i=0,n=0;
cout<<"Inserte tamaño de la Rayuela: ";
cin>>n;
caminos(i,n);
return 0;
}
void caminos (int i,int n){
if(i<=n){
cout<<i;
caminos(i+1,n);
if(i+2<n){
cout<<i;
caminos(i+2,n);
}
}
else{
cout<<endl;
}
}