## Count the number of sub-arrays such that the average of elements present in the sub-array is greater than that not present in the sub-array

Given an array of integers arr[], the task is to count the number of sub-arrays such that the average of elements present in the sub-array… Read More »

## Find the number of sub arrays in the permutation of first N natural numbers such that their median is M

Given an array arr[] containing the permutation of first N natural numbers and an integer M ≤ N. The task is to find the number… Read More »

## Range Queries to Find number of sub-arrays with a given xor

Given an array arr[] of size n and q queries and an integer k. Each query consists of an index range [l, r] and the… Read More »

## Maximum Subarray Sum after inverting at most two elements

Given an array arr[] of integer elements, the task is to find maximum possible sub-array sum after changing the signs of at most two elements.… Read More »

## Count the number of non-increasing subarrays

Given an array of N integers. The task is to count the number of subarrays (of size at least one) that are non-increasing. Examples: Input… Read More »

## Compute maximum of the function efficiently over all sub-arrays

Given an array, arr[] and a function F(i, j). The task is to compute max{F(i, j)} over all sub-arrays [i..j]. The fucntion F() is defined… Read More »

## Count sub-arrays whose product is divisible by k

Given an integer K and an array arr[], the task is to count all the sub-arrays whose product is divisible by K. Examples: Input: arr[]… Read More »

## Minimum value among AND of elements of every subset of an array

Given an array of integers, the task is to find the AND of all elements of each subset of the array and print the minimum… Read More »

## Count pairs in array whose sum is divisible by K

Given an array A[] and positive integer K, the task is to count total number of pairs in the array whose sum is divisible by… Read More »

## Longest sub-array whose product is 0

Given an array arr[] of integer elements, the task is to find the length of the longest sub-array whose product is 0. Examples: Input: arr[]… Read More »

## Maximum average of a subarray of size of atleast X and atmost Y

Given an array arr[] and two integers X and Y. The task is to find a sub-array of size of atleast X and atmost Y… Read More »

## Minimum LCM and GCD possible among all possible sub-arrays

Given an array arr[] of N positive integers, the task is to find the minimum LCM and GCD between elements of all possible sub-array. Examples:… Read More »

## Sum of minimum element of all subarrays of a sorted array

Given a sorted array A of n integers. The task is to find the sum of minimum of all possible subarrays of A. Examples: Input:… Read More »

## Maximum length of the sub-array whose first and last elements are same

Given a character array arr[] containing only lowercase English alphabets, the task is to print the maximum length of the subarray such that the first… Read More »

## Maximize the maximum among minimum of K consecutive sub-arrays

Given an integer K and an array arr[], the task is to split the array arr[] into K consecutive subarrays to find the maximum possible… Read More »