Skip to content

Category Archives: Sorting

Given a 3D array of size N*M*P consisting only of English alphabet characters, the task is to print the frequency of all the elements in… Read More
Given an array arr[] of length N containing non negative integers, the task is to find the last remaining element after performing the following operations… Read More
Given an array arr[] of size N where arr[i] ≤ N, the task is to find the minimum number of operations to sort the array… Read More
Given two Arrays A[] and B[] each of size N, the task is to check if the given arrays are valid or not, based on… Read More
Given an array arr[] which contains N positive integers and an integer K. The task is to count all triplets whose XOR is equal to… Read More
Given an array arr[] of size N consisting of positive integers, the task is to check if the array can be sorted in non-decreasing order… Read More
Given string str of size N and two integers M and K (N is divisible by M), the task is to find the Kth non-overlapping… Read More
Given a linked list, the task is to sort the linked list using HeapSort. Examples: Input: list = 7 -> 698147078 -> 1123629290 -> 1849873707… Read More
Given a 2D array arr[] having N rows of variable size, the task is to sort the array in lexicographical order i.e., sort each row… Read More
Given an array of arr[] of N integers, the task is to find the minimum number of moves to sort the array in non-decreasing order… Read More
Given an array arr[] of N small and/or large numbers, the task is to find the largest and smallest number in this array. Examples: Input:… Read More
Given an array A[] of size N consisting of N integers, the task is to count the number of pairs such that their average is… Read More
Given a binary string s of length N, the task is to find the lexicographically smallest string using infinite number of swaps between 0’s and… Read More
Given an array arr[] of N integers, the task is to sort the array by replacing any element at index i (arr[i]) with arr[j] –… Read More
Given an array arr[] of size N and an integer K, the task is to find the size of the largest subset possible having a… Read More