# Category Archives: Sorting

Given an array arr[] consisting of N distinct integers, the task is to rearrange the array such that no element is same as its index… Read More
Given a 2D array ranges[][] of size N * 2, with each row representing a range of the form [L, R], the task is to… Read More
Given an array arr[] of size N, two positive integers M and K, the task is to partition the array into M equal length subsets… Read More
Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More
Given an array arr[] consisting of N positive integers and an integer K, the task is to minimize the difference between the maximum and minimum… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to split the array into K subsets (N % K… Read More
Given an array arr[] of size N, the task is to find the frequency of each distinct element present in the given array. Examples: Input:… Read More
Given an array arr[] consisting of N unique elements, the task is to generate an array B[] of length N such that B[i] is the… Read More
Given an array arr[] representing burst time of N processes scheduled using the Round Robin Algorithm with given quantum time Q. Assuming that all the… Read More
Given two strings str1 and str2, the task is to check if a string str1 can be converted to string str2 by performing the following… Read More
Given an array arr[] of size N and an integer K, the task is to sort the array such that the first K elements of… Read More
Given an array, arr[] of size N and an integer K ( N % K = 0), the task is find the maximum cost to… Read More
Given a text file “file.txt” that consists of strings, the task is to sort all the strings in alphabetical order in that text file. Recommended:… Read More
Given an integer N, the task is to print all numbers from 1 to N ( N < 100000) in words in lexicographical order. Examples… Read More
Given two integers X and Y and a binary array arr[] of length N whose first and last element is 1, the task is to… Read More