题目描述
blablabla
样例
blablabla
算法1
class Solution(object):
def isPopOrder(self, pushV, popV):
"""
:type pushV: list[int]
:type popV: list[int]
:rtype: bool
"""
if len(pushV) != len(popV):
return False
stack = []
for num in pushV:
stack.append(num)
while stack and stack[-1] == popV[0]:
stack.pop()
popV.pop(0)
return stack == []