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

leetcode525相同个数01的最长连续子数组 | 算法加油站 #6

Open
zuodexin opened this issue Aug 8, 2021 · 0 comments
Open

Comments

@zuodexin
Copy link
Owner

zuodexin commented Aug 8, 2021

https://zuodexin.github.io/2020/11/17/leetcode525%E7%9B%B8%E5%90%8C%E4%B8%AA%E6%95%B001%E7%9A%84%E6%9C%80%E9%95%BF%E8%BF%9E%E7%BB%AD%E5%AD%90%E6%95%B0%E7%BB%84/#more

维护变量count,遇到0减1,遇到1加一,记录遇到count的最早位置,下次遇到后计算长度,画个折线图就能理解为什么这两个位置间的01个数相等。 扩展一下,以后遇到这种相等的可以考虑一下这种折线图的解法。

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

No branches or pull requests

1 participant