# Category Archives: Arrays

## Program to print an array in Pendulum ArrangementMay 10, 2017

Write a program to input a list of integers in an array and arrange them in a way similar to the to-and-fro movement of a… Read More »

## Largest sum contiguous increasing subarray

Given an array of n positive distinct integers. The problem is to find the largest sum of contiguous increasing subarray in O(n) time complexity. Examples:… Read More »

## Prefix Sum Array – Implementation and Applications in Competitive Programming

Introduction and Implementation : Given an array arr[] of size n, its prefix sum array is another array prefixSum[] of same size such that the… Read More »

## Find missing number in another array which is shuffled copyMay 9, 2017

Given an array ‘arr1’ of n positive integers. Contents of arr1[] are copied to another array ‘arr2’, but numbers are shuffled and one element is… Read More »

## Smallest Difference Triplet from Three arraysMay 7, 2017

Three arrays of same size are given. Find a triplet such that maximum – minimum in that triplet is minimum of all the triplets. A… Read More »

## Program for average of an array (Iterative and Recursive)May 3, 2017

Given an array, the task is to find average of that array. Average is the sum of array elements divided by the number of elements.… Read More »

## Program to check if an array is sorted or not (Iterative and Recursive)

Given an array of size n, write a program to check if it is sorted in ascending order or not. Equal values are allowed in… Read More »

## Count of arrays in which all adjacent elements are such that one of them divide the anotherMay 2, 2017

Given two positive integer n and n. The task is to find the number of arrays of size n that can be formed such that… Read More »

## Subsequence with maximum odd sumApril 22, 2017

Given a set of integers, check whether there is a subsequence with odd sum and if yes, then finding the maximum odd sum. If no… Read More »

## Minimum toggles to partition a binary array so that it has first 0s then 1sApril 20, 2017

Given an array of n integers containing only 0 and 1. Find the minimum toggles (switch from 0 to 1 or vice-versa) required such the… Read More »

## Count the number of subarrays having a given XOR

Given an array of integers arr[] and a number m, count the number of subarrays having XOR of their elements as m. Examples: Input :… Read More »

## Place k elements such that minimum distance is maximizedApril 18, 2017

Given an array representing n positions along a straight line. Find k (where k

## Find Duplicates of array using bit array

You have an array of N numbers, where N is at most 32,000. The array may have duplicates entries and you do not know what… Read More »

## Window Sliding TechniqueApril 16, 2017

This technique shows how a nested for loop in few problems can be converted to single for loop and hence reducing the time complexity. Let’s… Read More »

## Perfect Sum Problem (Print all subsets with given sum)April 15, 2017

Given an array of integers and a sum, the task is to print all subsets of given array with sum equal to given sum. Examples:… Read More »