can someone please help for me to change this function to iterative?
int recursive(int n)
{
int total = 0;
if(n>=3)
return recursive(n-1) + 2*recursive(n-2) + 2*recursive(n-3);
else if(n>=2)
return total + recursive(n-1) + 2*recursive(n-2);
else
return total+1;
}