#14074. [GESP202609 六级 C++] 第 25 题

[GESP202609 六级 C++] 第 25 题

下列递归程序能得到正确的斐波那契数,其时间复杂度和空间复杂度都是 O(n)O(n)

int fib(int n) {
  if (n <= 1)
     return n;
  return fib(n - 1) + fib(n - 2);
}

{{ select(1) }}

  • 正确
  • 错误