Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f8bec20

Browse files
Update Readme.md
1 parent b074f12 commit f8bec20

File tree

1 file changed

+1
-1
lines changed
  • Two_Pointers/3641.Longest-Semi-Repeating-Subarray

1 file changed

+1
-1
lines changed

‎Two_Pointers/3641.Longest-Semi-Repeating-Subarray/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
非常明显的双指针,但是滑窗右边界j的控制需要格外小心。
44

5-
对于任意的左边界i,当满足`while (j+1<n && count<=k)`时(count统计repeat元素的个数),可以将nums[++j]加入统计。如果循环退出,注意有两种情况:
5+
对于任意的左边界i,当满足`while (j+1<n && count<=k)`时(count变量用于统计repeat元素的个数),说明可以将nums[++j]加入统计。如果循环退出,注意有两种不同情况:
66
1. 如果count>k,那么意味着j超出了合法的范围,合法subarray的长度最多是`j-i`.
77
2. 如果count<=k,那么意味着j已经到了最后一个元素(即n-1)但是仍未超出合法范围,故此时合法subarray的长度是`j-i+1`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /