##
Tracking current Maximum Element in a Stack
July 21, 2017

Given a Stack, keep track of the maximum value in it. The maximum value may be the top element of the stack, but once a… Read More »

July 21, 2017

Given a Stack, keep track of the maximum value in it. The maximum value may be the top element of the stack, but once a… Read More »

A stack permutation is a permutation of objects in the given input queue which is done by transferring elements from input queue to the output… Read More »

July 17, 2017

Given a binary tree, print all the ancestors of a particular key existing in the tree without using recursion. Here we will be discussing the… Read More »

July 12, 2017

Create a customized data structure such that it has functions :- GetLastElement(); RemoveLastElement(); AddElement() GetMin() All the functions should be of O(1) Question Source :… Read More »

July 1, 2017

Given a stack of integers, sort it in ascending order using another temporary stack. Examples: Input : [34, 3, 31, 98, 92, 23] Output :… Read More »

June 24, 2017

Suppose we have two Strings :- Pattern and Text pattern: consisting of unique characters text: consisting of any length We need to find the number… Read More »

June 22, 2017

Prerequisite : Bubble Sort Write a function that sort an array of integers using stacks and also uses bubble sort paradigm. Recommended: Please try your… Read More »

An encoded string (s) is given, the task is to decode it. The pattern in which the strings are encoded is as follows. <count>[sub_str] ==>… Read More »

June 8, 2017

Given a sequence of n strings, the task is to check if any two similar words come together then they destroy each other then print… Read More »

May 25, 2017

How to Implement stack using a priority queue(using min heap)?. Asked In: Microsoft, Adobe. Recommended: Please try your approach on {IDE} first, before moving on… Read More »

May 6, 2017

Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out)… Read More »

January 17, 2017

There are some natural number whose all permutation is greater than or equal to that number eg. 123, whose all the permutation (123, 231, 321)… Read More »

December 21, 2016

Given three stack of the positive numbers, the task is to find the possible equal maximum sum of the stacks with removal of top elements… Read More »

December 10, 2016

Given array of integer, find the next smaller of next greater element of every element in array. Note : Elements for which no greater element… Read More »

November 28, 2016

Given array of integers, the task is to find the maximum absolute difference between nearest left and right smaller element of every element in array.… Read More »