Stack is a data structure that stores items in last in first out manner.
It operates on the principle of adding and removing elements from the top.
A stack typically provides two main operations:
Stacks are commonly implemented using arrays or linked lists.
In both cases, the stack operations (push and pop) have a time complexity of O(1), making them efficient.

To understand Stacks better. Let’s go with an Example:
Imagine you have a pile of colorful blocks, and you want to organize them in a way that you can easily access and play with them. 🧱🧱🧱🧱🧱
But instead of organizing them neatly in a row, you decide to stack them on top of each other, just like building a tower! 🗼
This is where a stack comes into play. A stack is like a tower made of blocks, but with some special rules. You can only add new blocks to the top of the tower, and you can only remove blocks from the top. 🧱
So, when you want to add a new block to the tower, you place it on top of the stack. And when you want to remove a block, you take it from the top. This means that the last block you put on the stack is the first one you take off. 🧱
Well, let's say you colored some blocks and you want to keep track of the order in which you colored each blocks. You can use a stack! Whenever you finish coloring a block, you add it to the top of the stack. If you want to see the last block you colored, you simply take it from the top of the stack. 🎨
Stacks also come in handy when you're solving puzzles or playing games. For example, your playing a chess game. in a game where you made a wrong move and you need to undo your moves, a stack can remember all the steps you took. Each move you make is added to the stack, and when you want to go back one step, you take it from the top of the stack. ⏪