## Maximum sum subarray of even length

Given an array arr[] of N elements, the task is to find the maximum sum of any subarray of length X such that X >… Read More »

## Smallest subarray with GCD as 1 | Segment Tree

Given an array arr[], the task is to find the smallest sub-arrays with GCD equal to 1. If there is no such sub-array then print… Read More »

## Maximum circular subarray sum of size K

Given an array arr of size N and an integer K, the task is to find the maximum sum subarray of size k among all… Read More »

## Number of subarrays with GCD equal to 1

Given an array arr[], the task is to find the number of sub-arrays with GCD value equal to 1. Examples: Input: arr[] = {1, 1,… Read More »

## Number of non-decreasing sub-arrays of length less than or equal to K

Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length less than… Read More »

## Number of non-decreasing sub-arrays of length greater than or equal to K

Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length greater than… Read More »

## Number of non-decreasing sub-arrays of length K

Given an array arr[] of length N, the task is to find the number of non-decreasing sub-arrays of length K. Examples: Input: arr[] = {1,… Read More »

## Minimize sum by dividing all elements of a subarray by K

Given an array arr[] of N integers and a positive integer K, the task is to minimize the sum of the array elements after performing… Read More »

## Length of the longest subsegment which is UpDown after inserting atmost one integer

A sequence of integers is said to be UpDown, if the inequality holds true. You are given a sequence . You can insert at most… Read More »

## Divide the array into minimum number of sub-arrays having unique elements

Given an array arr. The task is to divide the array into the minimum number of subarrays containing unique elements and return the count of… Read More »

## Maximum length sub-array which satisfies the given conditions

Given an array arr[] of N integers, the task is to find the maximum length of any sub-array of arr[] which satisfies one of the… Read More »

## Divide an array into K subarray with the given condition

Given an array arr[] and an integer K. The task is to divide the array into K parts ( subarray ) such that the sum… Read More »

## Number of triplets in array having subarray xor equal

Given an array of integers Arr. The task is to count the number of triplets (i, j, k) such that Ai ^ Ai+1 ^ Ai+2… Read More »

## Number of Subarrays with positive product

Given an array arr[] of N integers, the task is to find the count of subarrays with positive product. Examples: Input: arr[] = {-1, 2,… Read More »

## Find subarray with given sum with negatives allowed in constant space

Given an unsorted array of integers, find a subarray which adds to a given number. If there are more than one subarrays with the sum… Read More »