Category Archives: Stack

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
Prerequisite: List, Stack Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has… Read More
Given a string S consisting of only lowercase letters, the task is to find the lexicographically largest string that can be obtained by removing K… Read More
Given an array arr[], the task is to print the number of elements which are greater than all the elements on its left as well… Read More
A function is a set of code that performs a specific task and can be used whenever needed just by calling it. While using multiple… Read More
Given a string S, the task is to change the string id it doesn’t follow any of the rules given below and print the updated… Read More
Given an array arr[], the task is to check that if there exist a triplet (i, j, k) such that arr[i]<arr[k]<arr[j] and i<j<k then print… Read More
Given an integer N, which denotes the size of the matrix that is N*N. There is a robot placed over the top-left corner (0, 0)… Read More