Category Archives: Arrays

Given an array of n positive integers. Write a program to find the sum of maximum sum subsequence of the given array such that the… Read More
Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. Examples : Input: arr[] = {1, 4, 20,… Read More
Create a data structure twoStacks that represents two stacks. Implementation of twoStacks should use only one array, i.e., both stacks should use the same array… Read More
Write a function to count number of smaller elements on right of each element in an array. Given an unsorted array arr[] of distinct integers,… Read More
Difficulty Level: Rookie Given a stream of numbers, print average (or mean) of the stream at every point. For example, let us consider the stream… Read More
Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array. Examples : Input: arr[] = {8,… Read More
Given an array A[0 … n-1] containing n positive integers, a subarray A[i … j] is bitonic if there is a k with i <=… Read More
Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is… Read More
Given a boolean matrix mat[M][N] of size M X N, modify it such that if a matrix cell mat[i][j] is 1 (or true) then make… Read More
Given an unsorted array of size n. Array elements are in the range from 1 to n. One number from set {1, 2, …n} is… Read More
Given an unsorted array arr[] and two numbers x and y, find the minimum distance between x and y in arr[]. The array might also… Read More
Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order. It… Read More
Given an array and an integer K, find the maximum for each and every contiguous subarray of size k.Examples :  Input: arr[] = {1, 2,… Read More
Given an array arr[], find the maximum j – i such that arr[j] > arr[i].Examples :  Input: {34, 8, 10, 3, 2, 80, 30, 33,… Read More