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.
Example 1:
Input: 1 2 3 4 5 4 5 3 2 1 Output: true
Example 2:
Input: 1 2 3 4 5 4 3 5 1 2 Output: false
Constraints:
- 1 ≤ pushed.length ≤ 1000
- 0 ≤ pushed[i] ≤ 1000
- All values of pushed are unique.
- popped.length == pushed.length
Input format: First line: pushed. Second line: popped.
Output format: true or false.