Skip to content

Category Archives: Stack

Given an array arr[] consisting of N positive integers, the task is to find the maximum product of subarray sum with the minimum element of… Read More
Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… 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
Given an undirected graph G with N nodes, M edges, and an integer K, the task is to find the maximum count of edges that… Read More
In a multi-threaded environment, the lock-free algorithms provide a way in which threads can access the shared resources without the complexity of Locks and without… Read More
Given a stack of integers S and an array of integers arr[], the task is to check if all the array elements are present in… Read More
Given a string, str, the task is to remove all the duplicate adjacent characters from the given string. Examples: Input: str= “azxxzy”Output: ay Removal of “xx”… Read More
Given a string S of valid parentheses sequence of length N and an even integer K, the task is to find the valid parentheses sequence… Read More
Given a string str and two integers X and Y, the task is to find the maximum cost required to remove all the substrings “pr”… Read More
Given a string str, the task is to reverse the string by considering each word of the string, str as a single unit.Examples: Input: str… Read More
Given a list arr[] of everyday temperatures. For each day, the task is to find the count of days remaining for the next day with… Read More
Given two numbers N1 and N2 represented by two stacks, such that their most significant digits are present at the bottom of the stack, the… Read More
Given an array a[] consisting of N integers, the task is to find the maximum possible sum that can be achieved by deducting any value,… Read More
Data Structure is the way of storing data in computer’s memory so that it can be used easily and efficiently. There are different data-structures used… Read More
Given an array A[] of N integers, the task is to find the relative rank for each element in the given array. The relative rank… Read More