In computer science, a stack is a collection of elements that follows a specific order: the last element added is the first one to be removed. This principle is called "Last In, First Out" (LIFO).

In LeetCode, there is a category of problems related to parenthesis matching. These types of problems can effectively help you understand the use of stacks and the principle of "Last In, First Out" that underlies them.

- 20. Valid Parentheses
- 1249. Minimum Remove to Make Valid Parentheses
- 921. Minimum Add to Make Parentheses Valid
- 856. Score of Parentheses
- 32. Longest Valid Parentheses

In some scenario, you don't really need to initialize a stack, like 921.

Given an arithmetic expression, how to calculate its result?

- 227. Basic Calculator II
- 224. Basic Calculator
- 772. Basic Calculator III
- 150. Evaluate Reverse Polish Notation

Monotonic stacks are particularly useful for problems where you need to find the next greater or smaller element in an array.

**Warm-up**

**Challenging**

**Hard**

There are three problems on LeetCode about removing duplicate elements. The problems are very similar, but the solutions are different.

- 1047. Remove All Adjacent Duplicates In String
- 1209. Remove All Adjacent Duplicates in String II
- 316. Remove Duplicate Letters

Use both Hash Table and Stack to solve problem