1
var validateStackSequences = function (pushed, popped) {
2
let stack = [];
3
let j = 0;
4

5
for (let i = 0; i < pushed.length; i++) {
6
stack.push(pushed[i]);
7
while (stack.length != 0 && popped[j] == stack[stack.length - 1]) {
8
stack.pop();
9
j++;
10
}
11
}
12
return stack.length < 1;
13
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0