动态规划:斐波那契数列
题目:https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3?tpId=295&tqId=23255&ru=/exam/oj&qru=/ta/format-top101/question-ranking&sourceUrl=%2Fexam%2Foj
经典的斐波那契数列还是没有忘记哈哈哈,但是刚开始还是忘记了一点,看到了题目提示还是记起来了,实际递归返回即可;
public class Solution { public int Fibonacci(int n) { if(n == 1) return 1; if(n == 2) return 1; return Fibonacci(n - 1) + Fibonacci(n - 2); } }