Medium
,Array
,Stack
Given two integer arrays pushed
and popped
each with distinct values, return true
if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false
otherwise.
Example 1:
Example 2:
Constraints:
pushed.length
<= 1000pushed[i]
<= 1000pushed
are unique.popped.length
== pushed.length
popped
is a permutation of pushed
.Ron ChenThr, Apr 13, 2023
MarsgoatThr, Apr 13, 2023
SheepThr, Apr 13, 2023