Given a 2D array arr[][] of size N, with each row representing intervals of the form {X, Y} ( 1-based indexing ), the task to… Read More

# Category Archives: Sorting

Given an array arr[] of size N and an array Q[] consisting of M integers, each representing a query, the task for each query Q[i]… Read More

Given an array arr[] of size N and an integer K, the task is to minimize the sum of difference between the maximum and minimum… Read More

Given a string R(x) of length n representing an expression having the set of words under the given grammar: For every lowercase letter x, R(x)… Read More

Given two arrays arr1[] and arr2[], both of size N and an integer X, the task is to check if the sum of same-indexed elements… Read More

Given an array arr[] of size N and an integer D, the task is to make all array elements equal by incrementing or decrementing minimum… Read More

Given an array A[] of size N and a positive integer K ( which will always be a factor of N), the task is to… Read More

Given a mountain array arr[] and an integer X, the task is to find the smallest index of X in the given array. If no… Read More

Given two arrays S[] and E[] of size N denoting starting and closing time of the shops and an integer value K denoting the number… Read More

Given an array arr[] consisting of N integers whose absolute values are distinct and an integer K, the task is to find such an arrangement… Read More

Given an array arr[] of size N, and an integer K, the task is to find the minimum count of pairs required to be removed… Read More

In this article, we will discuss the difference between the Insertion sort and the Selection sort: Insertion sort is a simple sorting algorithm that works… Read More

Given two positive integers A and C, the task is to check if a number B exists such that A + B = C and… Read More

Given an array arr[] of size N, the task is to find the total count of operations required to remove all the array elements such… Read More

Given an array arr[] of size N and a positive integer K, the task is to find the minimum possible cost to split the array… Read More