Skip to content

Commit 376bec8

Browse files
authored
Update leetcode560和为K的子数组.md
1 parent 8ef6320 commit 376bec8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

animation-simulation/前缀和/leetcode560和为K的子数组.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public:
164164
//细节,这里需要预存前缀和为 0 的情况,会漏掉前几位就满足的情况
165165
//例如输入[1,1,0],k = 2 如果没有这行代码,则会返回0,漏掉了1+1=2,和1+1+0=2的情况
166166
//输入:[3,1,1,0] k = 2时则不会漏掉
167-
//因为presum[3] - presum[0]表示前面 3 位的和,所以需要map.put(0,1),垫下底
167+
//因为presum[3] - presum[0]表示前面 3 位的和,所以需要m.insert({0,1}),垫下底
168168
m.insert({0, 1});
169169
int count = 0;
170170
int presum = 0;

0 commit comments

Comments
 (0)