题解 | #栈的压入、弹出序列#
栈的压入、弹出序列
https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106
class Solution: def IsPopOrder(self , pushV: List[int], popV: List[int]) -> bool: # write code here ck_stack = [] n = len(pushV) while pushV: ck_stack.append(pushV.pop(0)) while ck_stack and ck_stack[-1] == popV[0]: ck_stack.pop() popV.pop(0) return not popV