# Category Archives: Arrays

## Noble integers in an array (count of greater elements is equal to value)April 14, 2017

Given an array arr[], find a Noble integer in it. An integer x is said to be Noble in arr[] if the number of integers… Read More »

## Find original array from encrypted array (An array of sums of other elements)April 12, 2017

Find original array from a given encrypted array of size n. Encrypted array is obtained by replacing each element of the original array by the… Read More »

## Minimum sum of absolute difference of pairs of two arraysApril 1, 2017

Given two arrays a[] and b[] of equal length n. The task is to pair each element of array a to an element in array… Read More »

## Find sum of non-repeating (distinct) elements in an arrayMarch 31, 2017

Given an integer array with repeated elements, the task is to find sum of all distinct elements in array. Examples: Input : arr[] = {12,… Read More »

## Given pairwise sum of n numbers, find the numbers

Pairwise sum of n (where n >= 3) numbers are given in a specified order, find the numbers. The order has pair sum of first… Read More »

## Split an array into two equal Sum subarrays

Given an array of integers greater than zero, find if it is possible to split it in two subarrays (without reordering the elements), such that… Read More »

## Count pairs in a sorted array whose sum is less than x

Given a sorted integer array and number x, the task is to count pairs in array whose sum is less than x. Examples: Input :… Read More »

## XOR of all subarray XORs | Set 1March 30, 2017

Given an array of integers, we need to get total XOR of all subarray XORs where subarray XOR can be obtained by XORing all elements… Read More »

## Search, insert and delete in a sorted array

In this post search, insert and delete operation in a sorted array is discussed. Recommended: Please solve it on “PRACTICE” first, before moving on to… Read More »

## Search, insert and delete in an unsorted array

In this post search, insert and delete operation in an unsorted array is discussed. Recommended: Please solve it on “PRACTICE” first, before moving on to… Read More »

## Find all pairs (a,b) and (c,d) in array which satisfy ab = cdMarch 29, 2017

Given an array of distinct integers, the task is to find two pairs (a, b) and (c, d) such that ab = cd, where a,… Read More »

## Convert an array to reduced form | Set 2 (Using vector of pairs)March 27, 2017

Given an array with n distinct elements, convert the given array to a form where all elements are in range from 0 to n-1. The… Read More »

## Fill an array based on frequency where elements are in range from 0 to n-1

Given an array of positive integers with duplicate allowed. The array contains elements from range 0 to n-1. The task is to fill the array… Read More »

## GCD of more than two (or array) numbers

Given an array of numbers, find GCD of the array elements. In a previous post we find GCD of two number. Examples: Input : arr[]… Read More »

## Minimum swaps to reach permuted array with at most 2 positions left swaps allowedMarch 26, 2017

Given a permuted array of length N of first N natural numbers, we need to tell the minimum number of swaps required in the sorted… Read More »