What is the time and space complexity of this function?

后端 未结 0 1332
半阙折子戏
半阙折子戏 2021-01-31 23:02
def f(n):
    if n < 3:
        return n
    else:
        return f(n - 1) + 2 * f(n - 2) + 3 * f(n - 3)

Time: O(n**3) Space: O(n)

Is this cor

相关标签:
回答
  • 消灭零回复
提交回复
热议问题