# Category Archives: Sorting

Given a string S of length N, the task is to sort the vowels of the given string in alphabetical order at place them accordingly… Read More
Given a grid consisting of horizontal & vertical bars of size (N + 2) x (M + 2) and two arrays H[] and V[] denoting… Read More
Given an array arr[] of size N, the task is to count the number of arrays having at least K elements greater than the XOR… Read More
Given an array arr[] consisting of N integers, the task is to find the maximum sum of absolute differences between all distinct pairs of the… Read More
Given an array arr[] consisting of N integers, and an integer X, the task is to find two elements from the array arr[] having sum… Read More
Given a string S of lowercase English alphabets, the task is to print the smallest word in the given string. Examples: Input: S = “sky… Read More
Given an array arr[] consisting of capacities of N buckets where arr[i] denotes the capacity of the ith bucket. If the total amount of water… Read More
Given an array A[] consiting of positive integers, the task is to find the minimum value of |A[x] – A[y]| + |A[y] – A[z]| of… Read More
Given an array arr[] consisting of N pairs [L, R], where L and R denotes the start and end indices of a segment, the task… Read More
Given an array arr[] of size N, the task is to find the maximum and minimum sum of Bitwise XOR of all pairs from an… Read More
Given an array arr[] of size N, the task is to find the lexicographically smallest permutation of the given array such that the sum of… Read More
Given an array arr[] of size N, the task is to split the array into the minimum number of subsets such that every element belongs… Read More
Selection sort is the simplest sorting algorithm that works by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it… Read More
Given an array arr[] of size N and an integer K, the task to find the maximum number of array elements that can be reduced… Read More
Given a string S of length N and an integer K, the task is to find the frequency of the lexicographically Kth smallest character present… Read More