# Category Archives: Sorting

Given an array A[] consisting 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
Given a string S of length N, the task is to make all characters of the string the same by incrementing/decrementing the ASCII value of… Read More
Given an array arr[] of size N, the task is to print the minimum possible count of strictly increasing subsequences present in the array. Note: It… Read More
Given an array arr[] consisting of N positive integers, the task is to check if it is possible to reduce the size of the array… Read More
Given a string S consisting of lowercase English alphabets, the task is to print the longest word present in the given string in python. Examples:… Read More
Given a triplet of integers (A, B, C), the task is to count the maximum number of decrements by 1 that can be performed on… Read More
Given a binary tree consisting of either 1 or 0 as its node values, the task is to find the sum of all vertical levels… Read More
Given an array arr[] consisting of N integers, the task is to find the integers whose digits are anagrams of each other and print the… Read More