A stack is a linear data structure that follows the principle of Last In First Out (LIFO) . This means that the element that is inserted last in the stack is the first one to be removed from it.
We add new elements or remove existing elements from the same end, commonly referred to as the top of the stack.