Skip to content

Category Archives: Queue

Given N integers, the task is to insert those elements in the queue. Also, given M integers, the task is to find the frequency of… 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
Given a queue q[] and an integer K, the task is to define a method to remove a specific element from the queue q[]. If… Read More
Given an undirected connected graph of N nodes and M edges. Each node has a light but at a time it can be either green… Read More
Given an array Intervals[] consisting of N pairs of integers where each pair is denoting the value range [L, R]. Also, given an integer array… Read More
Given a sorted array arr[] of the first N Natural Numbers and an integer X, the task is to print the last remaining element after… Read More
Given a matrix arr[][] of dimension M*N consisting of positive integers, where arr[i][j] represents the height of each unit cell, the task is to find… Read More
Given string S and a positive integer K, the task is to find lexicographically the largest possible string using at most K swaps with the… Read More
Given two sorted arrays A[] and B[] of sizes N and M respectively, the task is to merge them in a sorted manner. Examples: Input:… Read More
Generating Random Unweighted Binary Tree: Since this is a tree, the test data generation plan is such that no cycle gets formed. The number of… Read More
Given an unweighted graph and a boolean array A[ ], where if the ith index of array A[ ] denotes if that node can can… Read More
The task is to implement a dynamic Deque using templates class and a circular array, having the following functionalities:   front(): Get the front item… Read More