algo/ds-class/shu-zu-lia-39fd9/qiang-hua--a9442/ #1548
Replies: 1 comment
-
525.连续数组中提及的preSum可以简化为变量,我的理解是只使用两个变量去保存preSum[i]和preSum[i-1],然后两个for loop合并,每次循环计算当前i对应的前缀和,并更新i-1的前缀和;再使用这个前缀和去判断是否在哈希表里存储过,进而进行res更新或是哈希表更新操作。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
algo/ds-class/shu-zu-lia-39fd9/qiang-hua--a9442/
一、前缀和 1314. 矩阵区域和 (https://leetcode.cn/problems/matrix-block-sum) 基本思路 解法代码 724. 寻找数组的中心下标 (https://leetcode.cn/problems/find-pivot-index) 基本思路 解法代码 二、前缀积 238. 除自身以外数组的乘积 (https...
https://labuladong.gitee.io/algo/ds-class/shu-zu-lia-39fd9/qiang-hua--a9442/
Beta Was this translation helpful? Give feedback.
All reactions