# -*- coding:utf-8 -*-
class Solution:
def IsPopOrder(self, pushV, popV):
# write code here
queue=[]
i,j=0,0
while i<len(pushV):
if pushV[i]!=popV[j]:
queue.append(pushV[i])
i+=1
else :
i+=1
j+=1
while queue and popV[j]==queue[-1]:
j+=1
queue.pop(-1)
if queue==[]:
return True
else:
return False
京公网安备 11010502036488号