Skip to content

Category Archives: Sorting

Given two arrays A[] and B[] with size N and M, the task is to find the minimum number of swaps between two arrays (can… Read More
Given an array A[] of N integers. Check if there exist 2 distinct sub-sequences X and Y of the given array, such that the sum… Read More
Given an array A of N integers, where: Each element of array represents the bit size of an imaginary unsigned integer datatype. If ith imaginary… Read More
Given an array of strings Arr[]. The task is to sort them in lexicographic order. Examples: Input: Arr[] = {“sort”, “this”, “list”}Output:  [list, sort, this]… Read More
Given a sorted array arr[] consisting of N integers without any duplicates, the task is to find the ranges of consecutive numbers from that array.… Read More
Given an array arr[] containing N points of 2D plane and a reference point P0 (a0 , b0), the task is to sort these points… Read More
Given an array arr[] of size N, the task is to minimize the number of steps to make all the array elements equal by performing… Read More
Given an array arr[] containing N elements, the task is to find the size of the largest subset for each array element arr[i] such that… Read More
Given an array A[] of integers whose length is N, (where N is even) the task is to check if A[] can be grouped into… Read More
Given an array arr[] of size N, the task is to find the minimum number of operations to reduce the array by deleting an element… Read More
Given an array arr[] that contains N real numbers. The task is to sort the array in decreasing order of the Fractional Values Note: If… Read More
Given an unsorted array A[] of N integers and integer K, the task is to count the minimum number of times K should be added… Read More
Given a head and a tail of a doubly linked list containing 0s and 1s, the task is to sort the Doubly linked list without… Read More
Given an array arr[] consisting of N positive integers. In one operation any number of the array can be decremented by 1. The task is… Read More
Sorting Data By Color allows us to segregate the data cells of a specific color. There can be many ways to sort by color like… Read More