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

单调栈 | LearningGp #17

Open
LearningGp opened this issue Jun 20, 2020 · 1 comment
Open

单调栈 | LearningGp #17

LearningGp opened this issue Jun 20, 2020 · 1 comment

Comments

@LearningGp
Copy link
Owner

https://arvinhe.club/2020/06/20/%E5%8D%95%E8%B0%83%E6%A0%88/#more

单调栈
定义
单调栈就是满足单调性的栈结构。
性质

单调栈里的元素具有单调性;
每个元素在入栈前,将栈顶破坏栈单调性的元素都出栈;
使用单调栈可以找到入栈时元素向左遍历到的第一个比他小(大)的元素;出栈时元素向右遍历第一个比他小(大)的元素。(做题大多依靠这条性质)

例题
739 每日温度
题目描述
请根据每日 气温 列表,重新生成一个列表。对应位置的输出为:要想观测到

@LearningGp
Copy link
Owner Author

单调栈

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