# Category Archives: Arrays

## Find Two Missing Numbers | Set 1 (An Interesting Linear Time Solution)September 6, 2016

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 »

## Third largest element in an array of distinct elementsAugust 30, 2016

Given an array of distinct elements, find third largest element in it. Example : Input : arr[] = {1, 14, 2, 16, 10, 20} Output… Read More »

## Reverse an array in groups of given size | Set 2 (Variations of Set 1 )August 23, 2016

Given an array, reverse every sub-array that satisfies the given constraints. We have discussed a solution where we reverse every sub-array formed by consecutive k… Read More »

## Reverse an array in groups of given sizeAugust 18, 2016

Given an array, reverse every sub-array formed by consecutive k elements. Examples: Input: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] k… Read More »

## Maximum Product Subarray | Set 2 (Using Two Traversals)August 17, 2016

Given an array that contains both positive and negative integers, find the product of the maximum product subarray. Expected Time complexity is O(n) and only… Read More »

## Find all triplets in a sorted array that forms Geometric ProgressionAugust 5, 2016

Given a sorted array of distinct positive integers, print all triplets that forms Geometric Progression with integral common ratio. A geometric progression is a sequence… Read More »

## Find if array can be divided into two subarrays of equal sumAugust 4, 2016

Given an array of integers, find if it’s possible to remove exactly one integer from the array that divides the array into two subarrays with… Read More »

## Jolly Jumper SequenceAugust 1, 2016

A sequence of n numbers (n < 3000) is called Jolly Jumper if the absolute values of the differences between the successive elements take on… Read More »

## Add elements of given arrays with given constraintsJuly 29, 2016

Given two integer arrays, add their elements into third array by satisfying following constraints – 1. Addition should be done starting from 0th index of… Read More »

## Largest product of a subarray of size kJuly 28, 2016

Given an array consisting of n positive integers, and an integer k. Find the largest product subarray of size k, i.e., find maximum produce of… Read More »

## Maximum sum of i*arr[i] among all rotations of a given arrayJuly 27, 2016

Given an array arr[] of n integers, find the maximum that maximizes sum of value of i*arr[i] where i varies from 0 to n-1. Examples:… Read More »

## Replace every element with the least greater element on its rightJuly 20, 2016

Given an array of integers, replace every element with the least greater element on its right side in the array. If there are no greater… Read More »

## Remove duplicates from an array of small primesJuly 11, 2016

Given an array of primes such that the range of primes is small. Remove duplicates from the array. Examples: Input : arr[] = {3, 5,… Read More »

## Find Surpasser Count of each element in arrayJuly 9, 2016

A surpasser of an element of an array is a greater element to its right, therefore x[j] is a surpasser of x[i] if i <… Read More »

## Print all subarrays with 0 sumJuly 5, 2016

Given an array, print all subarrays in the array which has sum 0. Examples: Input: arr = [6, 3, -1, -3, 4, -2, 2, 4,… Read More »