package main
// import "fmt"
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param pushV int整型一维数组
* @param popV int整型一维数组
* @return bool布尔型
*/
func IsPopOrder( pushV []int , popV []int ) bool {
// write code here
n := 0
if len(pushV) != len(popV) {
return false
}
var stack = make([]int, 0)
for i := 0; i < len(pushV); i++ {
stack = append(stack, pushV[i])
length := len(stack)
for ;length > 0 && stack[length - 1] == popV[n]; {
stack = stack[:length - 1]
n++
length--
}
}
if len(stack) == 0 {
return true
} else {
return false
}
}