Given a stack S, the task is to copy the content of the given stack S to another stack T maintaining the same order. Examples:… Read More

# Category Archives: Stack

Given two positive integers X and Y and two numeric strings S and P of length N and 2 respectively, the task is to find… Read More

Given a Binary Tree, the task is to print the Bottom-left to Upward-right Traversal of the given Binary Tree i.e., the level order traversal having… Read More

In this article, we will discuss how to implement a Stack using list in C++ STL. Stack is a linear data structure which follows. LIFO(Last… Read More

Given a string S size of N consisting of characters ‘a‘, ‘b‘, and ‘c‘ only, the task is to check if the given string can… Read More

Given an array arr[] consisting of N distinct integers. For each i (0 ≤ i < n), find a range [l, r] such that A[i]… Read More

Design a special dynamic Stack using an array that supports all the stack operations such as push(), pop(), peek(), isEmpty(), and getMin() operations in constant… Read More

Given a binary string S of size N, the task is to find the number of groups of 1s only in the string S. Examples:… Read More

Given a binary string S of size N and a number K, the task is to find if all the ‘0’s can be changed into… Read More

Given a string s consisting of parentheses {‘(‘ and ‘)’} and integers, the task is to construct a Binary Tree from it and print its… Read More

Given a stack S, the task is to reverse the stack S using two additional stacks. Example: Input: S={1, 2, 3, 4, 5}Output: 5 4… Read More

Given an array arr[] consisting of N integers, where each array element represents the height of a building situated on the X co-ordinates, the task… Read More