Skip to content

Category Archives: Queue

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
Given a Binary Search Tree consisting of N nodes and two positive integers L and R, the task is to find the sum of values… Read More
Given a Binary Tree consisting of N nodes and two integers K and L, the task is to add one row of nodes of value… Read More
Given a Binary Tree consisting of N nodes, the task is to find the number of paths from the root to any node X, such… Read More
Given two positive integers A, B, and an array D[] consisting only of digits [0-9], the task is to check if it is possible to… Read More
Given a string S consisting of N characters, the task is to find the length of all prefixes of the given string S that are… Read More