# Category Archives: Arrays

## Maximum distance between two occurrences of same element in array

Given an array with repeated elements, the task is to find the maximum distance two occurrences of an element. Examples: Input : arr[] = {3,… Read More »

## Maximum subsequence sum such that no three are consecutive

Given a sequence of positive numbers, find the maximum sum that can be formed which has no three consecutive elements present. Examples: Input: arr[] =… Read More »

## Maximize array sum after K negations | Set 2

Given an array of size n and a number k. We must modify array K number of times. Here modify array means in each operation… Read More »

## Find elements larger than half of the elements in an array

Given an array of n elements, the task is to find the elements that are greater than half of elements in an array. In case… Read More »

## Find next Smaller of next Greater in an array

Given array of integer, find the next smaller of next greater element of every element in array. Note : Elements for which no greater element… Read More »

## Find Maximum XOR value of a sub-array of size k

Given an array of integers, the task is to find maximum XOR value of a subarray of size K. Examples: Input : arr[] = {2,… Read More »

## Minimum delete operations to make all elements of array same

Given an array of n elements such that elements may repeat. We can delete any number of elements from array. The task is to find… Read More »

## Find Maximum Sum Strictly Increasing Subarray

Given an array of positive integers. Find the maximum sum of strictly increasing subarrays. Note that this problem is different from maximum subarray sum and… Read More »

## Sum of maximum elements of all subsets

Given an array of integer numbers, we need to find sum of maximum number of all possible subsets. Examples: Input : arr = {3, 2,… Read More »

## Find Equal (or Middle) Point in a sorted array with duplicates

Given a sorted array of n size, the task is to find whether an element exists in the array from where number of smaller elements… Read More »

## Minimum swaps to make two arrays identical

Given two arrays which have same values but in different order, we need to make second array same as first array using minimum number of… Read More »

## Find maximum difference between nearest left and right smaller elements

Given array of integers, the task is to find the maximum absolute difference between nearest left and right smaller element of every element in array.… Read More »

## Number of swaps to sort when only adjacent swapping allowed

Given an array arr[] of non negative integers. We can perform a swap operation on any two adjacent elements in the array. Find the minimum… Read More »

## Minimum number of swaps required to sort an array

Given an array of n distinct elements, find the minimum number of swaps required to sort the array. Examples: Input : {4, 3, 2, 1}… Read More »

## Maximum sum of pairs with specific difference

Given an array of integers and a number k. We can pair two number of array if difference between them is strictly less than k.… Read More »