Skip to content

Tag Archives: cpp-stack-functions

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
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 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 a numeric string S consisting of N digits, the task is to find the minimum length of the string that can be formed by… Read More
Given a Stack consisting of N elements, the task is to reverse the Stack using an extra stack. Examples: Input: stack = {1, 2, 3,… Read More
Given a string S, the task is to check if the string target is a subsequence of string S or not, using a Stack. Examples:… Read More
Given two numbers A and B, the task is to remove the trailing zeros present in the sum of the two given numbers using a… Read More
The task is to implement some important functions of stack like pop(), push(), display(), topElement(), isEmpty(), isFull() using class template in C++. Stack is a… Read More
Given a string S consisting of characters ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’, the task is to remove all balanced bracket subsequences from the string… Read More
Given an integer N, the task is to print prime factors of N in decreasing order using the stack data structure. Examples: Input: N =… Read More
Given a string S of size N consisting of ‘(‘, ‘)’, and ‘$’, the task is to check whether the given string can be converted… Read More
Given two strings S1 and S2 of length N and M respectively, consisting of lowercase letters, the task is to find the minimum length to… Read More
Given a binary string str of size N, the task is to minimize the length of given binary string by removing even length substrings consisting… Read More