A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle. This means that the last element added to the stack will be the first element to be removed.
The two primary operations on a stack are:
Push: Adds an element to the top of the stack.
Pop: Removes the element from the top of the stack.
Other operations include `Peek` or `Top` (view the top element without removing it) and `isEmpty` (check if the stack is empty).