Problem 716 · Hard

Max Stack

A stack that can also report and remove its largest value, preferring the most recent of equal values.

Open the interactive visualisation