摘要:
优先级队列中存了我自定义的对象,比较规则写好了,存完了之后我去修改堆中对象的值(比较器中写的值),发现堆没有即刻相应调整,导致结果不对 但是每次我让堆中出一个,再进一个堆就调整好了 暂时不知道什么原因,猜测可能是堆中存对象的话需要改动才会调整。我猜不可能维护一个后台线程一直去调整它 答复: 通过简单 阅读全文
摘要:
解决: 原因:node版本高于16,项目的版本不高于16。 解决方法: 在命令行修改环境变量:$env:NODE_OPTIONS="--openssl-legacy-provider" 然后 npm run serve 阅读全文
摘要:
797. 所有可能的路径 https://leetcode.cn/problems/all-paths-from-source-to-target/description/ List<List<Integer>> res; List<Integer> path; public List<List<I 阅读全文
摘要:
77. 组合 https://leetcode.cn/problems/combinations/description/ List<List<Integer>> res = new ArrayList<>(); List<Integer> path = new ArrayList<>(); pub 阅读全文
摘要:
530. 二叉搜索树的最小绝对差 https://leetcode.cn/problems/minimum-absolute-difference-in-bst/description/ TreeNode pre = null; int res = Integer.MAX_VALUE; public 阅读全文
摘要:
94. 二叉树的中序遍历 https://leetcode.cn/problems/binary-tree-inorder-traversal/description/?envType=study-plan-v2&envId=top-100-liked // 递归 // List<Integer> 阅读全文
摘要:
LRU https://leetcode.cn/problems/lru-cache/description/?envType=study-plan-v2&envId=top-100-liked class LRUCache { HashMap<Integer,DLinkedNode> map; i 阅读全文
摘要:
区分 默认背包问题都先遍历物品(物品重量)再遍历背包(背包大小)但是不绝对 0-1背包问题遍历背包时逆序, 完全背包问题遍历背包时正序 求最大价值,dp初始值就小点(一般0就行),求最小价值,dp初始值就大点(找个数 Interger最大值或者背包大小+1W这种) 完全背包中 如果求组合数(顺序无关 阅读全文
摘要:
70. 爬楼梯 https://leetcode.cn/problems/climbing-stairs/description/?envType=study-plan-v2&envId=top-100-liked public int climbStairs(int n) { if (n <= 1 阅读全文
摘要:
数位dp https://leetcode.cn/problems/reverse-bits-lcci/description/ public int reverseBits(int num) { int max = 0; int dp1 = 0; int dp2 = 0; for (int i = 阅读全文