摘要: 题目:【https://leetcode.cn/problems/h-index/?envType=study-plan-v2&envId=top-interview-150】 其实就是理解成两个维度,找到两个维度在相互制衡情况下的公共最大值。 1 class Solution { 2 public 阅读全文
posted @ 2025-06-03 18:00 J&YANG 阅读(13) 评论(0) 推荐(0)
摘要: 力扣53. 最大子数组和:【https://leetcode.cn/problems/maximum-subarray/description/】 经典的dp + 空间优化,代码如下 1 class Solution { 2 public: 3 int maxSubArray(vector<int> 阅读全文
posted @ 2025-06-03 16:11 J&YANG 阅读(17) 评论(0) 推荐(0)
摘要: 题目:【https://leetcode.cn/problems/majority-element/?envType=study-plan-v2&envId=top-interview-150】 这个题目跟找数量最多的数字有区别,这里面的算法也属于单独适合这个题的算法。 通常来说,看到这种题目第一想 阅读全文
posted @ 2025-06-03 09:55 J&YANG 阅读(17) 评论(0) 推荐(0)