Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0487 笔误 #169

Open
lirichardil opened this issue Aug 27, 2024 · 0 comments
Open

0487 笔误 #169

lirichardil opened this issue Aug 27, 2024 · 0 comments

Comments

@lirichardil
Copy link

  • 一开始,$left$、$right$ 都指向 $0$
  • 如果 $nums[right] == 0$,则窗口内 $1$ 的个数加 $1$
  • 如果该窗口中 $1$ 的个数多于 $1$ 个,即 $zero\underline{\hspace{0.5em}}count > 1$,则不断右移 $left$,缩小滑动窗口长度,并更新窗口中 $1$ 的个数,直到 $zero\underline{\hspace{0.5em}}count \le 1$
  • 维护更新最大连续 $1$ 的个数。然后右移 $right$,直到 $right \ge len(nums)$ 结束。
  • 输出最大连续 $1$ 的个数。

“Zero_cout 记录的应该是0 的个数,不是1 的个数”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant