随笔分类 - algorithm
摘要:https://leetcode.cn/problems/min-cost-climbing-stairs/  { for (int i = 0; i <= 2; i +
阅读全文
摘要:###通过数组进行线性递推 用空间换时间是确实比递归要快很多 #include <iostream> #include <cstring> #include <algorithm> #include<cstdio> using namespace std; int main() { long lon
阅读全文
摘要:递归的写法 第一种写法—朴素DFS求解 时间复杂度O(2^n) int fib(long long x) { if(x==1) return 1; if (x==2) return 1; return fib(x-1)+ fib(x-2); } 递归写法的劣势在于计算到第40个之后速度就会肉眼可见的
阅读全文