leetle

Daily challenge for 2026-05-02

487. Browser History Back Button

You are given a list of operations representing a browser history. 'PUSH' adds a page to the stack, and 'BACK' removes the most recently added page. Return the final list of pages remaining in the history stack after all operations are processed. If 'BACK' is called on an empty stack, do nothing.

Example: Input: ops = ['PUSH A', 'PUSH B', 'BACK', 'PUSH C'] Output: ['A', 'C']

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