Given an array arr[] consisting of N integers, the task is to find the maximum number of pairs of array elements such that each pair… Read More

# Tag Archives: priority-queue

Given three arrays X[], Y[], and Z[] each consisting of N integers, the task is to find the maximum number of triplets (X[i], Y[i], Z[i])… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to split the given array into K non-overlapping subsets such… Read More

Given an integer N, representing the number of workers, an array speed[ ], where speed[i] represents the speed of the ith worker, and an array efficiency[… Read More

Given a directed and weighted graph of N nodes and M edges, the task is to find the 1st to Kth shortest path lengths from… 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 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 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

Given an array arr[] consisting of N positive integers such that arr[i] represents that the ith bag contains arr[i] diamonds and a positive integer K,… Read More

Given an array arr[] consisting of N positive integers, such that arr[i] represents the number of products the ith supplier has and a positive integer,… Read More

Given a sorted 2D array arr[][2] of size N such that (arr[i][0], arr[i][1]) represents the coordinates of ith point in the cartesian plane and an… Read More

Given a 2D array arr[][3] consisting of information of N trains where arr[i][0] is the train number, arr[i][1] is the arrival time, and arr[i][2] is… Read More

Given a weighted graph consisting of N nodes and M edges, a source vertex, a destination vertex, and an integer K, the task is to… Read More

Given a Graph consisting of N vertices and M weighted edges and an array edges[][], with each row representing the two vertices connected by the… Read More

Given an array arr[][] consisting of N lists representing N transactions, the task is to merge the given lists of transactions in the order of… Read More