1 2 3 4 5 ··· 8 下一页
摘要: [Algo] 贪心策略4 1. 跳跃游戏 II // 1. 跳跃游戏 II // https://leetcode.cn/problems/jump-game-ii/ int jump(vector<int>& nums) { int len = nums.size(); int cur = 0, 阅读全文
posted @ 2025-06-14 09:02 yaoguyuan 阅读(1) 评论(0) 推荐(0)
摘要: [Algo] 贪心策略3 1. 最小区间 // 1. 最小区间 // https://leetcode.cn/problems/smallest-range-covering-elements-from-k-lists/ class Node { public: int v; // 值 int i; 阅读全文
posted @ 2025-06-14 09:02 yaoguyuan 阅读(1) 评论(0) 推荐(0)
摘要: [Algo] 贪心策略2 1. 砍竹子 II // 1. 砍竹子 II // https://leetcode.cn/problems/jian-sheng-zi-ii-lcof/description/ int p(int base, int power, int mod) { int ans = 阅读全文
posted @ 2025-06-14 09:02 yaoguyuan 阅读(0) 评论(0) 推荐(0)
摘要: [Algo] 贪心策略 1. 最大数 // 1. 最大数 // https://leetcode.cn/problems/largest-number/ string largestNumber(vector<int>& nums) { int len = nums.size(); vector<s 阅读全文
posted @ 2025-06-14 09:01 yaoguyuan 阅读(1) 评论(0) 推荐(0)
摘要: [Algo] 路径信息 1. 最长公共子序列 // 1. 最长公共子序列 // https://www.nowcoder.com/practice/4727c06b9ee9446cab2e859b4bb86bb8 void dp1(string& s1, string& s2, vector<vec 阅读全文
posted @ 2025-06-05 14:00 yaoguyuan 阅读(2) 评论(0) 推荐(0)
摘要: [Algo] 数位dp 1. 最大为N的数字组合 // 1. 最大为N的数字组合 // https://leetcode.cn/problems/numbers-at-most-n-given-digit-set/ int func1(vector<int>& digit, int n, int l 阅读全文
posted @ 2025-06-05 14:00 yaoguyuan 阅读(2) 评论(0) 推荐(0)
摘要: [Algo] 优化枚举2 1. K个逆序对数组 // 1. K个逆序对数组 // https://leetcode.cn/problems/k-inverse-pairs-array/ int kInversePairs(int n, int k) { vector<vector<int>> dp( 阅读全文
posted @ 2025-03-28 10:51 yaoguyuan 阅读(9) 评论(0) 推荐(0)
摘要: [Algo] 优化枚举 1. 买卖股票的最佳时机 III // 1. 买卖股票的最佳时机 III // https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-iii/ int maxProfit(vector<int>& price 阅读全文
posted @ 2025-03-28 10:51 yaoguyuan 阅读(3) 评论(0) 推荐(0)
摘要: [Algo] 状压dp2 1. 每个人戴不同帽子的方案数 // 1. 每个人戴不同帽子的方案数 // https://leetcode.cn/problems/number-of-ways-to-wear-different-hats-to-each-other/ int func1(int n, 阅读全文
posted @ 2025-03-25 15:53 yaoguyuan 阅读(1) 评论(0) 推荐(0)
摘要: [Algo] 状压dp 1. 我能赢吗 // 1. 我能赢吗 // https://leetcode.cn/problems/can-i-win/ bool func1(int n, int status, int rest, vector<int>& dp) { if (rest <= 0) re 阅读全文
posted @ 2025-03-25 15:53 yaoguyuan 阅读(5) 评论(0) 推荐(0)
1 2 3 4 5 ··· 8 下一页