Stack and doubly linked lists are two important data structures with their own benefits. Stack is a data structure that follows the LIFO technique and… Read More
Category Archives: Stack
Given a stack of M elements and a queue of N elements in sorted order. The task is to find out the common elements of… Read More
Given an array arr[], the task is to find the minimum number of deletion operations required such that: The newly created array should have an… Read More
Given a binary matrix mat[][] of size N*M, find the maximum size rectangle binary-sub-matrix with all 1’s. Examples: Input: mat[][] = { {0, 1, 1,… Read More
Given a stack St of M elements and a queue Q of N elements. The task is to put every element of stack into the… Read More
Given an array arr[] of size N, the task is to find the final array by repeatedly performing the following operations if two elements of… Read More
Given two binary trees T1 and T2 and integer K, the task is to check whether both trees are identical or not after making exactly… Read More
Given an array height[] which represents the height of N people standing in a line. A person i can see a person j if height[j]… Read More
Given a stack S and an integer K, the task is to reverse the first K elements of the given stack Examples: Input: S = [… Read More
Given a string S of N characters, the task is to find the smallest lexicographical string after performing each of the following operations N times… Read More
Given two stacks stack1[] and stack2[] of size N and M respectively and an integer K, The task is to count the maximum number of… Read More
Given an array integers[] of integers of size N. Find the resulting output array after doing some operations: If the (i-1)th element is positive and… Read More
Given an array arr[], of size N the task is to find the minimum operations on the array such that in each operation any element… Read More