A Stack is a linear data structure that follows the Last In First Out (LIFO) principle. Elements can be added and removed only from the top of the stack.
import { Stack } from "collection-kit";
import { Stack } from "collection-kit";
const stack = new Stack();
stack.push(10);
stack.push(20);
stack.push(30);
console.log("Top element:", stack.peek()); // 30
console.log("Popped:", stack.pop()); // 30
console.log("Size:", stack.size()); // 2