Given an array arr[] and an integer N, the task is to find the maximum number of pairs that can be formed such that ith… Read More
Category Archives: Queue
Given an array arr[] of integers of size N, the task is to count the number of elements whose value is greater than all the… Read More
Given a 2-D array matrix[][] of size ROW * COL and an integer K, where each cell matrix[i][j] is either 0 (empty) or 1 (obstacle).… Read More
Given an array interval of length N, where each element represents three values, i.e. {startTime, endTime, value}. The task is to find the maximum sum… Read More
Given two flavors of ice-cream chocolate and vanilla denoted by 0 and 1 respectively. People are standing in queue to get their desired flavor of… Read More
Given an array arr[] of size N, the task is to find the minimum number of operations required to make all array elements zero. In… Read More
Given an array arr[] of size N and an integer X, the task is to find the length of the longest subsequence such that the… Read More
Given a Binary Tree, the task is to find the sum of leaf nodes at every level of the given tree. Examples: Input: Output:0063012Explanation:Level 1:… Read More
Given a queue consisting of the first N natural numbers and queries Query[][] of the type {E, X}, the task is to perform the given… Read More
The queue is an abstract data type which is defined by following structure and operations. Queue is structured as an ordered collection of items which… Read More
Given an undirected graph consisting of N nodes and M edges, the task is to find the minimum length of the path from Node 1… Read More
Given two integers N and M, the task is to find the sequence of the minimum number of operations required to convert the number N… Read More
Given a generic tree consisting of N nodes and (N – 1) edges and an array of queries query[] of size Q consisting of the… Read More
Given a Generic Tree consisting of N nodes, the task is to find the left and right views of the given generic Tree. Examples: Input:… Read More