# Tag Archives: limited-range-elements

## Find duplicates in constant array with elements 0 to N-1 in O(1) space

Given a constant array of n elements which contains elements from 1 to n-1, with any of these numbers appearing any number of times. Find… Read More »

## Sort an array containing two types of elements

We are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More »

## Find the only repetitive element between 1 to n-1

We are given an array arr[] of size n. Numbers are from 1 to (n-1) in random order. The array has only one repetitive element.… Read More »

## Check if the array is beautiful

Given an integer n and an array of size n check if it satisfies following conditions:- All elements of array must lie between 1 to… Read More »

## Find the one missing number in range

Given an array of size n. It is also given that range of numbers is from smallestNumber to smallestNumber + n where smallestNumber is the… Read More »

## Sort an array of 0s, 1s and 2s (Simple Counting)

Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s… Read More »

## Sorting using trivial hash function

Sorting using trivial hash function. Examples: Input : 9 4 3 5 8 Output : 3 4 5 8 9 We have read about various… Read More »

## Find four missing numbers in an array containing elements from 1 to N

Given an array of unique integers where each integer of the given array lies in the range [1, N]. The size of array is (N-4).… Read More »

## Sum of array elements that is first continuously increasing then decreasing

Given an array where elements are first continuously increasing and after that its continuously decreasing unit first number is reached again. We want to add… Read More »

## Smallest element in an array that is repeated exactly ‘k’ times.

Given an array of size n, the goal is to find out the smallest number that is repeated exactly ‘k’ times where k > 0?… Read More »

## Find the missing number in a sorted array of limited range

Given a sorted array of size n and given that there are numbers from 1 to n+1 with one missing, the missing number is to… Read More »

## Find Two Missing Numbers | Set 2 (XOR based solution)

Given an array of n unique integers where each element in the array is in range [1, n]. The array has all distinct elements and… Read More »

## Find even occurring elements in an array of limited range

Given an array that contains odd number of occurrences for all numbers except for a few elements which are present even number of times. Find… Read More »

## Find missing elements of a range

Given an array arr[0..n-1] of distinct elements and a range [low, high], find all numbers that are in range, but not in array. The missing… Read More »

## Count frequencies of all elements in array in O(1) extra space and O(n) time

Given an unsorted array of n integers which can contain integers from 1 to n. Some elements can be repeated multiple times and some other… Read More »