leetcode3026专题

Leetcode3026. 最大好子数组和

Every day a Leetcode 题目来源:3026. 最大好子数组和 解法1:哈希 + 前缀和 哈希表 hash = unordered_map<int, vector<long long>> 存储数组 nums 的元素 x 及其到 x 为止的前缀和 preSum。 遍历数组 nums,设当前元素为 x,前缀和为 sum: 在哈希表中寻找键 x + k,若找到,更新答案 an