【发布时间】:2019-09-15 02:34:46
【问题描述】:
我需要为这个递归函数写一个迭代函数。
int funcRec(int n){
if(n>1) {
return 2*funcRec(n - 1) + 3*funcRec(n - 2);
}else{
return n;
}
}
【问题讨论】:
-
如果你需要这样做,你应该在寻求帮助之前尝试一下。到目前为止,您尝试过什么?
-
欢迎来到 Stack Overflow。请阅读the help pages,获取the SO tour,了解how to ask good questions,以及this question checklist。最后请学习如何创建minimal reproducible example。
-
我会从一张纸和一支铅笔开始