Category Archives: Stack

Given a queue Q containing N strings, the task is to restructure the queue to double its size such that the second half represents the… Read More
A balanced sequence is defined as a string in which for every opening bracket there are 2 continuous closing brackets. Thus, {}}, {{}}}}, {{}}{}}}} are… Read More
Given a number N, the task is to write C/C++ program to print the number from N to 1 by calling the main() function using… Read More
Given an unsorted array of length N. The task is to sort the array, such that abs(a[i]-a[i+1]) < = abs(a[i+1]-a[i+2]) for all 0 < =… Read More
Data structure is a way of storing and organising data efficiently such that the required operations on them can be performed efficiently with respect to… Read More
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? filter_none edit close play_arrow link brightness_4 code import java.util.*;    class Demo… 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