leetle

Daily challenge for 2026-01-27

392. Simple Stack Sequence Validator

Given a sequence of numbers pushed and a sequence popped, determine if popped could have been the result of a sequence of push and pop operations on an initially empty stack using the elements from pushed in order. The input arrays will contain unique elements.

Example 1:
Input: pushed = [1,2,3,4,5], popped = [4,5,3,2,1]
Output: true

Example 2:
Input: pushed = [1,2,3,4,5], popped = [4,3,5,1,2]
Output: false

Run this challenge interactively in Python or JavaScript when the app loads.