# Stacks A stack is the right tool whenever you need to process elements in a last-in-first-out order, or when you need to track something that will be resolved later. Many stack problems involve matching pairs, maintaining a running minimum or maximum, or deferring a computation until a future element triggers it. The monotonic stack variant, where you maintain elements in increasing or decreasing order, is particularly important and appears frequently in harder problems involving histograms, temperatures, and next greater elements. Visit the following resources to learn more: - [@article@DSA Stacks](https://www.w3schools.com/dsa/dsa_data_stacks.php) - [@video@wtf is “the stack” ?](https://www.youtube.com/watch?v=CRTR5ljBjPM)