Stacks and Queues
23 problems to practice.
Stock Span
1. Implement the functions of class StockSpanner. 2. next() collects daily price quotes for the s...
Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the a...
Duplicate Brackets
1. You are given a string exp representing an expression. 2. Assume that the expression is balanced...
Balanced Brackets
1. You are given a string exp representing an expression. 2. You are required to check if the expre...
Largest Area Histogram
1. You are given a number n, representing the size of array a. 2. You are given n numbers, represen...
Infix Evaluation
1. You are given an infix expression. 2. You are required to evaluate and print it's value.
Infix Conversions
1. You are given an infix expression. 2. You are required to convert it to postfix and print it. 3...
Postfix Evaluation And Conversions
1. You are given a postfix expression. 2. You are required to evaluate it and print it's value. 3....
Prefix Evaluation And Conversions
1. You are given a prefix expression. 2. You are required to evaluate it and print it's value. 3....
Celebrity Problem
1. You are given a number n, representing the number of people in a party. 2. You are given n str...
Merge Overlapping Interval
1. You are given a number n, representing the number of time-intervals. 2. In the next n lines, you...
Smallest Number Following Pattern
1. You are given a pattern of upto 8 length containing characters 'i' and 'd'. 2. 'd' stands for de...
Normal Stack
1. You are required to complete the code of our CustomStack class. The class should mimic the behavi...
Dynamic Stack
1. You are given the code of our CustomStack class which mimics the java.util.Stack class. 2. Here...
Normal Queue
1. You are required to complete the code of our CustomQueue class. The class should mimic the behavi...
Dynamic Queue
1. You are required to complete the code of our CustomQueue class. The class should mimic the behavi...
Minimum Stack - I
1. You are required to complete the code of our MinStack class. 2. As data members you've two sta...
Minimum Stack - Constant Space
1. You are required to complete the code of our MinStack class. 2. As data members you've one stac...
Queue To Stack Adapter - Push Efficient
1. You are required to complete the code of our QueueToStackAdapter class. 2. As data members you'...
Queue To Stack Adapter - Pop Efficient
1. You are required to complete the code of our QueueToStackAdapter class. 2. As data members you'...
Stack To Queue Adapter - Add Efficient
1. You are required to complete the code of our StackToQueueAdapter class. The class should mimic t...
Stack To Queue Adapter - Remove Efficient
1. You are required to complete the code of our StackToQueueAdapter class. The class should mimic th...
Two Stacks In An Array
1. You are required to complete the code of our TwoStack class. The class should implement LIFO beh...