Tag: stack


Balanced brackets problem

Balanced brackets problem is one of the famous problems based on the stack and it has been asked in many …

Nearest greater to right

Write a program to find the nearest greater element or next greater to the right of each element in an …

Stack using array

In this tutorial, we will implement a stack using array by using the fixed array and dynamic array method with …

Stack using linked list

In this tutorial, we will implement a stack using linked list with their time and space complexity.

Nearest greater to left

Write a program to find the nearest greater element or next greater to the left of each element in an …

Stock span problem

Stock span problem is a financial problem mostly asked in interviews and its optimized solution can be obtained using stack …

Nearest smaller to right

Write a program to find the nearest smaller element or next smaller element to the right of each element in …

Nearest smaller to left

Write a program to find the nearest smaller element to the left of each element in an array.

Maximum area histogram

Write a program to find the maximum area under histogram or largest rectangle in a histogram. It's optimized solution …