Skip to content

Category Archives: Sorting

Given a list of ranges with starting and end value, the task is to find the minimum number of ranges that are required to be… Read More
Given an array arr[] of N integers. The task is to check whether by arranging the elements of the array, is it possible to generate… Read More
Given an array arr[] of N non-negative integers, the task is to sort these integers according to their reverse Examples:  Input: arr[] = {12, 10,… Read More
Given two numbers A and B, the task is to find the arrangement of digits of A such that it is just greater than the… Read More
Given an array arr[] of N integers, the task is to count the number of pairs with positive sum. Examples: Input: arr[] = {-7, -1,… Read More
Given a matrix of N rows and M columns, the task is to sort the matrix in the strict order that is every row is… Read More
Given strings str1 and str2. The task is to find that if str1 is substring in shuffled form of str2 or not. Print “YES” if… Read More
Given an array of natural numbers upto N and two numbers M and K, the task is to find the sum of M maximum distinct… Read More
Given an array arr[] of positive integers of even length, the task is to partition these elements of arr[] into two groups each of odd… Read More
Given an array arr[] of N integers. The task is to sort the array arr[] according to the frequency of elements in decreasing order. Note: If… Read More
Given an array arr[] and an integer N, the task is to find a number K from the given array such that if all the… Read More
Given an array arr[] of distinct integers from 1 to N. The task is to find the minimum number of swaps required to sort the… Read More
Given different intervals, the task is to print the maximum number of overlap among these intervals at any time. Examples:  Input: v = {{1, 2},… Read More
Given two sorted arrays arr1[] and arr2[], the task is to merge them in O(Nlog(N) + Mlog(M)) time with O(1) extra space into a sorted… Read More
Given an array arr[] of size N, the task is to print the arrangement of the array such that upon performing the following operations on… Read More