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 »

Find the longest Fibonacci-like subarray of the given array

Given an array of N elements, the task is to find the longest subarray which is Fibonacci-like. A Fibonacci-like sub-array is defined as an array… Read More »

Length of the longest alternating subarray

Given an array of N including positive and negative numbers only. The task is to find the length of the longest alternating (means negative-positive-negative or… Read More »

Maximum size of sub-array that satisfies the given condition

Given an array arr[] of integers. The task is to return the length of the maximum size sub-array such that either one of the condition… Read More »

Check if array can be divided into two sub-arrays such that their absolute difference is K

Given an array arr[] and an integer K, the task is to find whether the array can be divided into two sub-arrays such that the… Read More »

Find the sums for which an array can be divided into sub-arrays of equal sum

Given an array of integers arr[], the task is to find all the values for sum such that for a value sum[i] the array can… Read More »

Count Subarrays with Consecutive elements differing by 1

Given an array arr[] of N integers. The task is to count the total number of subarrays of the given array such that difference between… Read More »

Maximum sum subarray such that start and end values are same

Given an array of N positive numbers, the task is to find a contiguous subarray (L-R) such that a[L]=a[R] and sum of a[L] + a[L+1]… Read More »

Check whether an Array is Subarray of another Array

Given two arrays A[] and B[] consisting of and integers. The task is to check whether the array B[] is a subarray of the array… Read More »

Largest sub-array whose all elements are perfect squares

Given an array of integer elements, the task is to find the length of the largest sub-array of such that all the elements of the… Read More »