Skip to content

Category Archives: Stack

Given a Binary Tree and an integer K where the tree has positive and negative nodes, the task is to print the elements of the… Read More
Given an array arr[], the task is to find the minimum steps required to make an array decreasing, where in each step remove all elements… Read More
Pre-requisites: Java Collection Framework. 1. What is the Output of following Java Program? import java.util.*;    class Demo {     public static void main(String[] args)     {… Read More
Stack: A stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the… Read More
Given an array arr[] of N integers. The task is to do the following operations:   Add a value X to all the element from from… Read More
Given an array arr[] of distinct elements, the task is to find the maximum of XOR value of the first and second maximum elements of… Read More
Given an array arr[] of size N, the task is to generate a Complete Binary Tree in such a way that sum of the non-leaf… Read More
Stack in STL Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at… Read More
Given an array, arr[] of size N, the task is to find the number of sub-arrays ending with arr[i] and arr[i] is the minimum element… Read More
Instruction formats are classified into different types depending upon the CPU organization. CPU organization is again classified into three types based on internal storage: Stack… Read More
Given an integer N, the task is to find the minimum integer that can be obtained from the given integer such that the adjacent digits… Read More
Given an array arr[] of distinct positive elements, the task is to find the number of unique pairs (a, b) such that a is the… Read More
Given an expression as a string str consisting of numbers and basic arithmetic operators(+, -, *, /), the task is to solve the expression. Note… Read More
Given an N * M matrix mat[][], the task is to find the area-wise largest rectangular sub-matrix such that each column and each row of… Read More
Given an array arr[] of N distinct positive integers, let’s denote max(i, j) and secondMax(i, j) as the maximum and the second maximum element of… Read More