## Maximum length L such that the sum of all subarrays of length L is less than K

Given an array of length N and an integer K. The task is to find the maximum length L such that all the subarrays of… Read More »

## Maximum product of sum of two contiguous subarrays of an array

Given an array arr[] of N positive integers, the task is to split the array into two contiguous subarrays such that the product of the… Read More »

## Count of elements such that difference between sum of left and right sub arrays is equal to a multiple of k

Given an array arr[] of length n and an integer k, the task is to find the number of indices from 2 to n-1 in… Read More »

## Find the smallest subarray having atleast one duplicate

Given an array arr of N elements, the task is to find the length of the smallest subarray of the given array that contains at… Read More »

## Subarray permutation that satisfies the given condition

Given a permutation of integers from 1 to N and an integer M, the task is to check if any subarray of the given permutation… Read More »

## Maximum XOR value of maximum and second maximum element among all possible subarrays

Given an array arr[] of N distinct positive integers, let’s denote max(i, j) and secondMax(i, j) as the maximum and the second maximum element of… Read More »

## Longest sub-array with maximum GCD

Given an array arr[] of length N, the task is the find the length of the longest sub-array with maximum possible GCD value. Examples: Input:… Read More »

## Count of subarrays having exactly K distinct elements

Given an array arr[] of size N and an integer K. The task is to find the count of subarrays such that each subarray has… Read More »

## Count subarrays such that remainder after dividing sum of elements by K gives count of elements

Given an array arr[] of size N and an element K. The task is to find the number of sub-arrays of the given array such… Read More »

## Minimum cells to be flipped to get a 2*2 submatrix with equal elements

Given a matrix of size M * N, the task is to find the count of the minimum number of cells that must be flipped… Read More »

## Maximum sum subarray after altering the array

Given an array arr[] of size N. The task is to find the maximum subarray sum possible after performing the given operation at most once.… Read More »

## Calculate the Sum of GCD over all subarrays

Given an array of integers, the task is to calculate the sum of GCD of all the subarrays of an array. GCD of an array… Read More »

## Count of subarrays with sum at least K

Given an array arr[] of size N and an integer K > 0. The task is to find the number of subarrays with sum at… Read More »

## Check if the product of the K largest sums of subarrays is greater than M

Given an array arr[] of N integers and two integers M and K. The task is to check if the product of the K largest… Read More »

## Find if a crest is present in the index range [L, R] of the given array

Given an array arr[] of N distinct elements and an index range [L, R]. The task is to find whether a crest is present in… Read More »