Problems
Problems on stack usually involve use cases in computer science when there is a need to revisit or re-track a stored set of data. A stack data structure can be used then to traverse the data in the reverse sequence of its storage. Various forms of problems whether in computer science such as caching, calculations, process or function call stacks, etc. or in the real world such as loading of bullets in a magazine and firing in the reverse order, unstacking a set of Russian dolls, etc. are all instances which utilize the stack-based strategy to be optimally and conveniently solved.
Next greater/smaller element using a monotonic queue
By Riya
● Published At Feb 2022
This blog covers an interview problem: find the Next greater/smaller element using a monotonic queue using various approaches along with the Java code.... Keep reading ..
Iterative Tower of Hanoi
By Soumya Agrawal
● Published At May 2022
In this article, we will discuss the iterative approach of the problem Tower of Hanoi. ... Keep reading ..
By Rhythm Jain
● Published At Nov 2021
Design A Minimum Stack
By Kabir Singh
● Published At Oct 2021
This blog discusses the solution to the problem of minimum stack in which we have to return the smallest element of a stack. Read the blog to learn more!... Keep reading ..
Trapping Rainwater
By Pranav Gautam
● Published At Oct 2021
Learn various ways to find the next greater and previous greater for every array element using trapping rainwater problem. ... Keep reading ..
Delete Middle Element Of The Stack
By Shreya Deep
● Published At Jan 2022
In this article, we’ll see how to delete middle element of a stack without using any additional data structure. ... Keep reading ..
Count array elements having at least one smaller element on its left and right side
By Yukti Kumari
● Published At Nov 2021
This article explains the solution to the problem of counting array elements having at least one smaller element on its left and right side.... Keep reading ..
Minimize the length of a given string by removing subsequences forming valid parenthesis
By Shreya Deep
● Published At Nov 2021
In this article, we’ll learn how to solve an interesting problem related to deleting balanced parenthesis.... Keep reading ..
Add two numbers represented by Stacks
By Urwashi Priya
● Published At Dec 2021
Diagonal Traverse ii
By Soumya Agrawal
● Published At Nov 2021
In this blog, we will build logic for the Diagonal traversal of integers and see the various implementations of this problem.... Keep reading ..
Minimize a binary string by repeatedly removing even-length substrings of the same characters
By Nishant Rana
● Published At Feb 2022
This blog will cover the question to minimize a binary string by repeatedly removing even length substrings of the same characters and discussing its Time and Space complexity. ... Keep reading ..
Minimize A String By Removing All Occurrences Of Another String
By Harsh Goyal
● Published At Nov 2021
This article will discuss the Minimize a string by removing all occurrences of another string problem and various ways to solve this problem, from the brute force approach to the efficient approach. ... Keep reading ..
Maximum Equal Sum in Three Stacks
By Arun Nawani
● Published At Nov 2021
In this blog, we’ll pick a problem to better Maximum Equal Sum in Three Stacks understand the stack as a data structure and its operations and how it can be used to efficiently handle certain problems. ... Keep reading ..
Print Stack Elements from Top to Bottom
By Soumya Agrawal
● Published At Nov 2021
In this article, we will cover the stack and its problem of printing the elements from top to bottom. ... Keep reading ..
Smallest String Obtained By Removing All Occurrences of 01 and 11 from the Binary String
By Rhythm Jain
● Published At Nov 2021
This article discusses the Problem of obtaining the smallest string possible by removing all occurrences of 01 and 11 from a binary string.... Keep reading ..
Count of days remaining for the next day with higher temperature
● Published At Nov 2021
This article discusses the problem of the count of days remaining for the next day with higher temperatures.... Keep reading ..
Count of strings that do not contain Arc intersection
By Yukti Kumari
● Published At Nov 2021
This article explains the solution to the problem to find the count of strings that do not contain arc intersections. ... Keep reading ..
Minimize Length of a String by Removing Pairs of Consecutive Increasing or Decreasing Digits
By Rhythm Jain
● Published At Nov 2021
This article discusses the Problem of  Minimising Length of a String by Removing Pairs of Consecutive Increasing or Decreasing Digits... Keep reading ..
Largest rectangle in histogram
By Shreya Deep
● Published At Dec 2021
In this article, we’ll learn how to find the largest rectangle in a histogram.... Keep reading ..
Reverse a linked list using Stack
By Sandeep kamila
● Published At Nov 2021
This article covers the approach of reversing a linked list using stack data structure with complete explanation and its implementation in C++.... Keep reading ..
Count subarrays for every array element in which they are the minimum
By Vibhor Bhatnagar
● Published At Nov 2021
This article will discuss the problem count subarrays for every array element in which they are the minimum.... Keep reading ..
Check if a string is a subsequence of another string using stack
By Riya
● Published At Feb 2022
This article will discuss the problem to check if a string is a subsequence of another string, its solution using stack and its C++ implementation, and the time and space complexities of the solution.... Keep reading ..
Program to insert an element at the Bottom of a Stack
By Urwashi Priya
● Published At Nov 2021
This article will brief you on how to insert an element at the Bottom of a Stack. ... Keep reading ..
Distance from Next Greater element
By Vibhor Bhatnagar
● Published At Nov 2021
In this article, we will discuss the problem distance from next greater element. ... Keep reading ..
Convert given Binary string S to all 1s by changing all 0s to 1s in range [i+1, i+K] if S[i] is ‘1’
By Aman Chourasiya
● Published At Nov 2021
In this blog, we will learn to solve a problem based on binary strings. We will discuss three approaches to solve the problem involving greedy and stack data structure concepts.... Keep reading ..
Count of groups of consecutive 1s in a given Binary String
By GAZAL ARORA
● Published At Dec 2021
In this blog, we will solve a programming question in which, in a given array, we have to count the number of groups that contain only 1s.... Keep reading ..
Check if a string consisting only of a, b, c can be made empty by removing substring “abc” recursively
By Nishant Rana
● Published At Feb 2022
This blog will cover the question to check if a string consisting only of a, b, c can be made empty by removing substring “abc” recursively and discussing its Time and Space complexity. ... Keep reading ..
Maximum range length such that A[i] is maximum in the given range for all i from [1, N]
By Vibhor Bhatnagar
● Published At Nov 2021
In this article, we will discuss the problem of Maximum range length such that A[i] is maximum in the given range for all i from [1, N].... Keep reading ..
Check if a string can be emptied by removing all subsequences of the form “10”
● Published At Nov 2021
This article discusses how to check if a string can be emptied by removing all the subsequences of the form "10".... Keep reading ..
Lexicographically smallest K-length subsequence from a given string
By Ishita Chawla
● Published At Dec 2021
This blog will discuss the problem to find the lexicographically smallest K-length subsequence from a given string. ... Keep reading ..
Reverse an array using Stack
By Nishant Rana
● Published At Feb 2022
This blog will cover the question to reverse an array using a Stack and discuss its Time and Space complexity. ... Keep reading ..
Count of subarrays starting or ending at an index i such that arr[i] is maximum in a subarray
By Vibhor Bhatnagar
● Published At Dec 2021
In this article, we will discuss the problem count of subarrays starting or ending at an index i such that arr[i] is maximum in a subarray. ... Keep reading ..
Check if string S1 can be formed using repeated insertions of another string S2
By Nishant Rana
● Published At Feb 2022
This blog will cover whether string S1 can be formed using repeated insertions of another string S2 and discuss its Time and Space complexity. ... Keep reading ..
Python program to reverse a stack
By Nishant Rana
● Published At Feb 2022
This blog will cover the question to reverse a Stack and discuss its Time and Space complexity. ... Keep reading ..
Modify Given Array By Reducing Each Element By Its Next Smaller Element
By Harsh Goyal
● Published At Dec 2021
This article will discuss the Modify given array by reducing each element by its next smaller element problem and various ways to solve this problem, from the brute force approach to the efficient approach.... Keep reading ..
Reverse words in a given String
By Alisha Chhabra
● Published At Nov 2021
This article revolves around the question which says Reverse words in a given String. ... Keep reading ..
Maximize the product of the subarray sum with its minimum element
By Urwashi Priya
● Published At Dec 2021
This article will brief you on how to Maximize the product of the subarray sum with its minimum element. ... Keep reading ..
Daily Temperatures
By Reet Maggo
● Published At Nov 2021
This article explains how to find the number of days remaining for the next day with higher temperatures. ... Keep reading ..
Minimum Removals to Make Valid Parentheses
By Sandeep kamila
● Published At Nov 2021
This blog will cover the approach of an interesting problem, Minimum removals to make valid parentheses with examples and C++ code.... Keep reading ..
Online Stock Span
By Urwashi Priya
● Published At Nov 2021
This article will brief you on finding the online stack span for each day of stock given as a stream of array elements.... Keep reading ..
Create Maximum Number
By Aman Chourasiya
● Published At Feb 2022
Arrays and stacks are widely asked topics in coding interviews. In this article, we will discuss a problem involving applications of topics like arrays, merge sort, and stacks.... Keep reading ..