Given a binary search tree, and an integer X, the task is to find if there exists a triplet with sum X. Print Yes or… Read More

# Category Archives: Stack

Given N elements and the task is to implement a stack which removes and returns the maximum frequency element on every pop operation. If there’s… Read More

Given string str consisting of multiple words, the task is to reverse the entire string word by word.Examples: Input: str = “I Love To Code” Output:… Read More

Given two Stacks, the task is to check if the given stacks are same or not. Two stacks are said to be same if they… Read More

Given a stack with n elements, the task is to remove all the elements of the stack without affecting the order of elements. Examples: Input… Read More

We have seen different ways of performing postorder traversal on Binary Trees. Post Order Traversal. Iterative Postorder Traversal using Two Stacks. Iterative Postorder Traversal using… Read More

The task is to design a stack which can get the maximum value in the stack in O(1) time without using an additional stack. Examples:… Read More

Given a binary tree, the task is to print all leaf nodes of the given binary tree from left to right. That is, the nodes… Read More

Given a linked list containing N nodes and a positive integer K where K should be less than or equal to N. The task is… Read More

Given a NxN matrix, the task is to find the sum of bit-wise OR of all of its rectangular sub-matrices. Examples: Input : arr[][] =… Read More

Given a NxN matrix, the task is to find the sum of bit-wise AND of all of its rectangular sub-matrices. Examples: Input : arr[][] =… Read More

Given a N*N binary matrix, task is to find the count of rectangular sub-matrices with OR value 1. Examples: Input : arr[][] = {{0, 0,… Read More

Given a N*N matrix containing only 0s and 1s, the task is to count the number of submatrices containing all 1s. Examples: Input : arr[][]… Read More