栈(stack)是先进后出的数据结构。单调栈在入栈时通过一定规则保持栈内元素有序(单调递增或单调递减),从而把「找左侧/右侧第一个更大/更小元素」从 O(n²) 降到 O(n)。
问题只在于,大多数普通用户其实卡在门外。
。关于这个话题,51吃瓜提供了深入分析
Pakistan bombs Kabul in 'open war' on Afghanistan's Taliban government
A simpler API would mean fewer concepts, fewer interactions between concepts, and fewer edge cases to get right resulting in more confidence that implementations actually behave consistently.