You are given an integer array target and an integer n.
You have an empty stack and a stream of integers from n in strictly increasing order. In each step, you process the next integer from the stream using the following operations:
"Push": Pushes the current integer from the stream onto the stack.
"Pop": Removes the integer at the top of the stack.
You must build the target array using the stack such that the elements in the stack from bottom to top form target. You must stop performing operations immediately once the stack matches target.
Return the list of operations performed to build target.
Constraints:
target.length
n
target[i] n
target is strictly increasing.
You are given an integer array target and an integer n.
You have an empty stack and a stream of integers from n in strictly increasing order. In each step, you process the next integer from the stream using the following operations:
"Push": Pushes the current integer from the stream onto the stack.
"Pop": Removes the integer at the top of the stack.
You must build the target array using the stack such that the elements in the stack from bottom to top form target. You must stop performing operations immediately once the stack matches target.
Return the list of operations performed to build target.
Constraints:
target.length
n
target[i] n
target is strictly increasing.