# Category Archives: Arrays

## Split the array and add the first part to the endSeptember 24, 2017

There is a given an array and split it from a specified position, and move the first part of array add to the end. Examples:… Read More »

## Remove minimum number of elements such that no common element exist in both arraySeptember 23, 2017

Given two arrays A[] and B[] consisting of n and m elements respectively. Find minimum number of elements to remove from each array such that… Read More »

## Range sum queries without updates

Given an array arr of integers of size n. We need to compute sum of elements from index i to index j. The queries consisting… Read More »

## Array range queries over range queriesSeptember 22, 2017

Given an array of size n and a give set of commands of size m. The commands are enumerated from 1 to m. These commands… Read More »

## Maximum area rectangle by picking four sides from arraySeptember 20, 2017

Given an array of n positive integers that represent lengths. Find out the maximum possible area whose four sides are picked from given array. Note… Read More »

## Minimum operation to make all elements equal in arraySeptember 18, 2017

Given an array with n positive integers. We need to find the minimum number of operation to make all elements equal. We can perform addition,… Read More »

## Minimum operations to make XOR of array zero

We are given an array of n elements. The task is to make XOR of whole array 0. We can do following to achieve this.… Read More »

## Symmetric difference of two sorted arraySeptember 15, 2017

There are two sorted array arr1 and arr2. We have to find the symmetric difference of Aarr1 and arr2. Symmetric Difference basically contains all elements… Read More »

## Efficiently merging two sorted arrays with O(1) extra spaceSeptember 14, 2017

Given two sorted arrays, we need to merge them in O((n+m)*log(n+m)) time with O(1) extra space into a sorted array, when n is the size… Read More »

## Positive elements at even and negative at odd positionsSeptember 12, 2017

You have been given an array and you have to make a program to convert that array such that positive elements occur at even numbered… Read More »

## Find the index of first 1 in an infinite sorted array of 0s and 1sSeptember 11, 2017

Given an infinite sorted array consisting 0s and 1s. The problem is to find the index of first ‘1’ in that array. As the array… Read More »

## Find the sum of maximum difference possible from all subset of a given array.

We are array arr[] of n non-negative integers (repeated elements allowed), find out the sum of maximum difference possible from all subsets of given array.… Read More »

## Maximum sum bitonic subarraySeptember 10, 2017

Given an array containing n numbers. The problem is to find the maximum sum bitonic subarray. A bitonic subarray is a subarray in which elements… Read More »

## Longest increasing subarraySeptember 9, 2017

Given an array containing n numbers. The problem is to find the length of the longest contiguous subarray such that every element in the subarray… Read More »

## Find minimum cost to buy all booksSeptember 8, 2017

Given an array of ratings for n books. Find the minimum cost to buy all books with below conditions : Cost of every book would… Read More »