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

# Category Archives: Heap

Given a positive integer K and a weighted undirected connected graph of N nodes and E edges as an array Edges[] of the type {u,… Read More

Given an array arr[] consisting of N integers and an array Query[][] consisting of M pairs of the type {L, R}, the task is to… Read More

Given a Binary Tree consisting of N nodes and a positive integer K, the task is to find the Kth largest number in the given… Read More

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

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 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 a positive integer N, the task is to find the largest and smallest elements, from the maximum leaf nodes of every possible binary max-heap… Read More

Given an array arr[] consisting of N pairs and a positive integer M, the task is to maximize the average of the ratio of the… Read More

Given an array arr[] consisting of N integers, the task is to find the length of the longest subsequence such that the prefix sum at… Read More

1. Heap :A heap is a tree based data structure in which tree should be almost complete. It is of two types i.e. max and… 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