# Category Archives: Heap

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 min… 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 positive integer K and an array arr[] consisting of N positive integers, such that arr[i] is the number of processes ith processor can… Read More
Given a sorted 2D array arr[] of size N such that (arr[i], arr[i]) represents the coordinates of ith point in the cartesian plane and an… Read More
Given an integer N, representing number of projects, two arrays P[] and C[], consisting of N integers, and two integers W and K where, W… Read More
Given a 2D array arr[] consisting of information of N trains where arr[i] is the train number, arr[i] is the arrival time, and arr[i] is… 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
Given an integer K denoting the fuel tank capacity of a car running at the cost of 1 liter / mtr on a straight path… Read More