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

# Tag Archives: cpp-stack

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 and a number K, the task is to find if all the ‘0’s can be changed into… 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

Given a stack S and an integer N, the task is to insert N at the bottom of the stack. Examples: Input: N = 7S =… Read More

Given an array arr[] consisting of N strings, the task is to find the total sum of the array brr[] (initially empty) constructed by performing… Read More

Given string str of length N, consisting of pairs of balanced parentheses, the task is to calculate the score of the given string based on… Read More

Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order iteratively using only one… Read More

Given a string str consisting of pairs of balanced parentheses, the task is to calculate the score of the given string based on the following… Read More

Given an array arr[] of length N, the task is to modify the given array by replacing each element of the given array by its… Read More

Given an array of strings arr[] representing the changed folder operations(Unix-style) performed on the file system. Initially, the file system opens in the main folder.… Read More

Design the forward and backward buttons of a Browser using Stack Data Structure. If at any instance, the URL does not exist after pressing any… Read More

Given an array of strings Q[], consisting of queries of the following types: “WRITE X”: Write a character X into the document. “UNDO”: Erases the… Read More

Given an array arr[] of size N, the task is to print the distance of every array element from its next greater element. For array… Read More