Stacks and queues interview questions
Brackets, monotonic stacks, next greater element, deques.
5 questions solved with this pattern, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 5 done, 0 saved
Build a stack using only queue operations.
Reported 73 times
Read the solutionStacks, queues and heapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2019, geeksforgeeks.org 2017
For every element of an array, find the next greater element to its right.
Reported 20 times
Read the solutionStacks, queues and heapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2015, geeksforgeeks.org 2012
Given bar heights of a histogram, find the area of the largest rectangle it contains.
Reported 19 times
Read the solutionStacks, queues and heapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2024, geeksforgeeks.org 2017
Implement a queue using two stacks.
Reported 18 times
Read the solutionStacks, queues and heapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2022, geeksforgeeks.org 2020
Check whether a string of brackets is balanced.
Reported 15 times
Read the solutionStacks, queues and heapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2022, geeksforgeeks.org 2016, geeksforgeeks.org 2013