NO7斐波那契数列 用递归的写法,复杂度将是O(2^n)级别的,无法忍受。 用三个变量存储递归的中间值,时间复杂度能到O(n)。 public int Fibonacci (int n) { // write code here int t1 = 1; int t2 = 1; int t3 =…
剑指offer67题-No7-No10.简单dp递归合集
10 篇文章