# Category Archives: Sorting (adsbygoogle = window.adsbygoogle || []).push({});

## Count pairs with given sum | Set 2

Given an array arr[] and an integer sum, the task is to find the number of pairs of integers in the array whose sum is… Read More »

## Case-specific sorting of Strings in O(n) time and O(1) space

Given a string str consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters separately such that if the ith… Read More »

## Arrange N elements in circular fashion such that all elements are strictly less than sum of adjacent elements

Given an array of N integers, the task is to arrange them in a circular arrangement in such a way that the element is strictly… Read More »

## Sort an array of strings based on the frequency of good words in them

Given a set of product reviews (R) by different customers and a string S containing good words separated by a _, the task is to… Read More »

## Greatest contiguous sub-array of size K

Given an array arr[] of integers and an integer K, the task is to find the greatest contiguous sub-array of size K. Sub-array X is… Read More »

## Find the longest string that can be made up of other strings from the array

Given an array of strings arr[], the task is to find the largest string in the array which is made up of the other strings… Read More »

## Maximum Length Chain of Pairs | Set-2

Given an array of pairs of numbers of size N. In every pair, the first number is always smaller than the second number. A pair… Read More »

## Unbounded Fractional Knapsack

Given weights and values of n items, the task is to put these items in a knapsack of capacity W to get the maximum total… Read More »

## Sort an array without changing position of negative numbers

Given an array arr[] of N integers, the task is to sort the array without changing the position of negative numbers (if any) i.e. the… Read More »

## Find a triplet in an array whose sum is closest to a given number

Given an array arr[] of N integers and an integer X, the task is to find three integers in arr[] such that the sum is… Read More »

## Number of subarrays having absolute sum greater than K | Set-2

Given an integer array arr[] of length N consisting of both positive and negative integers, the task is to find the number of sub-arrays with… Read More »

## Build original array from the given sub-sequences

Given an integer N and valid subsequences of an array of integers where every element is distinct and from the range [0, N – 1],… Read More »

## Find three element from given three arrays such that their sum is X | Set 2

Given three sorted integer arrays A[], B[] and C[], the task is to find three integers, one from each array such that they sum up… Read More »

## Sum of Semi-Prime Numbers less than or equal to N

Given an integer N, the task is to find the sum of semi-prime numbers which are less than or equal to N. A Semi prime… Read More »

## Check if given string can be formed by two other strings or their permutations

Given a string str and an array of strings arr[], the task is to check if the given string can be formed by any of… Read More »