Skip to content

Tag Archives: cpp-stack-functions

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
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 arr[] of size N, the task is to print the distance of every array element from its next greater element. For array… Read More
C++ filter_none edit close play_arrow link brightness_4 code // C++ code #include <iostream> #include <utility> using namespace std;   int main() {     // Declaring the… Read More
Given an array arr[] of distinct positive elements, the task is to find the number of unique pairs (a, b) such that a is the… Read More
Given an array arr[] of N distinct positive integers, let’s denote max(i, j) and secondMax(i, j) as the maximum and the second maximum element of… Read More
Given N ranges [L, R] and an integer K, the task is to check if there are any K ranges which overlap at any point.… Read More
Given a string consisting of lower case alphabets. Rules of the Game: A player can choose a pair of similar consecutive characters and erase them.… Read More
Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end and… Read More
Stacks are a type of container adaptors with LIFO(Last In First Out) type of work, where a new element is added at one end and… Read More
Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end and… Read More