摘要: LRU https://leetcode.cn/problems/lru-cache/description/?envType=study-plan-v2&envId=top-100-liked class LRUCache { HashMap<Integer,DLinkedNode> map; i 阅读全文
posted @ 2024-03-29 20:18 jeasonGo 阅读(32) 评论(0) 推荐(0)
摘要: 区分 默认背包问题都先遍历物品(物品重量)再遍历背包(背包大小)但是不绝对 0-1背包问题遍历背包时逆序, 完全背包问题遍历背包时正序 求最大价值,dp初始值就小点(一般0就行),求最小价值,dp初始值就大点(找个数 Interger最大值或者背包大小+1W这种) 完全背包中 如果求组合数(顺序无关 阅读全文
posted @ 2024-03-29 13:59 jeasonGo 阅读(108) 评论(0) 推荐(0)
摘要: 70. 爬楼梯 https://leetcode.cn/problems/climbing-stairs/description/?envType=study-plan-v2&envId=top-100-liked public int climbStairs(int n) { if (n <= 1 阅读全文
posted @ 2024-03-29 11:04 jeasonGo 阅读(57) 评论(0) 推荐(0)