Skip to content

Category Archives: Sorting

Given an array arr[] consisting of the first N natural numbers, the task is to find the minimum number of subarrays required to be rearranged… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the maximum sum of K pairs of the… Read More
Given a positive integer K and two arrays A[] and B[] of size N and M respectively, each containing elements in the range [1, K].… Read More
Given an array arr[] of size N, consisting of distinct elements, the task is to count the number triplets such that (arr[j] – arr[i]) ≤… Read More
Given an integer K and an array arr[] consisting of N integers, where an array element arr[i] represents the price of the ith book. Profit… Read More
Given an array arr[] consisting of N integers, the task is to find the largest number K (> 0) such that both the values K… Read More
Given two positive integers, N and M, and an array arr[ ] consisting of (N + M) integers such that the first N elements are… Read More
Given an array arr[] consisting of N positive integers and an integer K, the task is to find the highest frequency of any array element… Read More
Given an array A[] of size N, the task is to find the minimum sum of numbers required to be added to array elements to… Read More
Given an array arr[] of size N, the task is to assign points to every distinct array element such that the sum of the points… Read More
Given an array arr[] of size N and a number K, the task is to partition the given array into K contiguous subarrays such that… Read More
Given an array arr[] consisting of N integers(N > 2), the task is to minimize the maximum difference between any pair of elements (arr[i], arr[j])… Read More
Given an array A[] consisting of N integers(1-based indexing), the task is to find the minimum value of the function  for any possible value of X.… Read More
Given an array p[] of size N representing a permutation of first N natural numbers, where N is an even number, the task is to… Read More