# Category Archives: Arrays

## Minimum subarray reversals required to make given binary array alternating

Given a binary array arr[] consisting of equal count of 0s and 1s, the task is to count the minimum number of subarray reversal operations… Read More »

## Find the next greater element in a Circular Array | Set 2

Given a circular array arr[] consisting of N integers, the task is to print the Next Greater Element for every element of the circular array.… Read More »

## Longest subarray in which all elements are smaller than K

Given an array arr[] consisting of N integers and an integer K, the task is to find the length of the longest subarray in which… Read More »

## C program to count frequency of each element in an array

Given an array arr[] of size N, the task is to find the frequency of each distinct element present in the given array. Examples: Input:… Read More »

## Longest subsequence having maximum sum

Given an array arr[] of size N, the task is to find the longest non-empty subsequence from the given array whose sum is maximum. Examples:… Read More »

## Count ways to make Bitwise XOR of odd and even indexed elements equal by removing an array element

Given an array arr[] of length N, the task is to find the count of array indices such that removing an element from these indices… Read More »

## Count ways to make sum of odd and even indexed elements equal by removing an array element

Given an array, arr[] of size N, the task is to find the count of array indices such that removing an element from these indices… Read More »

## Modify given array by reducing each element by its next smaller element

Given an array arr[] of length N, the task is to modify the given array by replacing each element of the given array by its… Read More »

## Farthest index that can be reached from the Kth index of given array by given operations

Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More »

## Split array into equal length subsets with maximum sum of Kth largest element of each subset

Given an array arr[] of size N, two positive integers M and K, the task is to partition the array into M equal length subsets… Read More »

## Minimize difference between maximum and minimum array elements by exactly K removals

Given an array arr[] consisting of N positive integers and an integer K, the task is to minimize the difference between the maximum and minimum… Read More »

## Maximize sum of K elements selected from a Matrix such that each selected element must be preceded by selected row elements

Given a 2D array arr[][] of size N * M, and an integer K, the task is to select K elements with maximum possible sum… Read More »

## Minimum number of rabbits that must be present in the forest

There are some colored rabbits in a forest. Given an array arr[] of size N, such that arr[i] denotes the number of rabbits having same… Read More »

## Minimum flips of odd indexed elements from odd length subarrays to make two given arrays equal

Given two binary arrays X[] and Y[] of size N, the task is to convert array X[] into array Y[] by minimum number of operations… Read More »

## Count clockwise array rotations required to maximize count of array elements present at indices same as their value

Given an array arr[] consisitng of a permutation of first N natural numbers, the task is to find the minimum number of clockwise circular rotations… Read More »