1: Given two sequences pushed and popped with distinct values. 2: You have to return true if and only if this could have been the result of a sequence of push and pop operations on an initially empty stack
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
1: pushed is a permutation of popped 2: pushed and popped have distinct values
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
1 2 3 4 5 4 5 3 2 1
Output
true