## Longest subarray with elements divisible by k

Suppose you a given an array. You have to find the length of the longest subarray such that each and every element of it is… Read More »

## Sum of minimum elements of all subarrays

Given an array A of n integers. The task is to find the sum of minimum of all possible (contiguous) subarray of A. Examples: Input:… Read More »

## Check if all sub-numbers have distinct Digit product

Given a number N, the task is to check if the all sub-numbers of this number have distinct digit product. Note: An N digit number… Read More »

## Maximize the number of subarrays with XOR as zero

Given an array of N numbers. The task is to maximize the number of subarrays with XOR value zero by swapping the bits of array… Read More »

## Smallest Integer to be inserted to have equal sums

Given an array of positive integers, find the smallest non-negative integer (i.e. greater than or equal to zero) that can be placed between any two… Read More »

## Length of the longest Subarray with only Even Elements

Given an array arr[]. The task is to find the length of the longest subarray of arr[] such that it contains only even elements. Examples:… Read More »

## Length of largest sub-array having primes strictly greater than non-primes

Given an array ‘arr’ of length ‘n’. The task is to find the largest contiguous sub-array having the count of prime numbers strictly greater than… Read More »

## Longest Prime Subarray after removing one element

Given an array A of integers. We can remove at most one index from the array. Our goal is to maximize the length of the… Read More »

## Longest Subarray with Sum greater than Equal to Zero

Given an array of N integers. The task is to find the maximum length subarray such that the sum of all its elements is greater… Read More »

## Longest subarray having difference in the count of 1’s and 0’s equal to k

Given a binary array arr[] of size n and a value k. The task is to find the length of the longest subarray having difference… Read More »

## Generating subarrays using recursion

Given an array, generate all the possible subarrays of the given array using recursion. Examples: Input : [1, 2, 3] Output : , [1, 2],… Read More »

## Check if subarray with given product exists in an array

Given an array of both positive and negative integers and a number K. The task is to check if any subarray with product K is… Read More »

## Subarray of size k with given sum

Given an array arr[], an integer K and a Sum. The task is to check if there exists any subarray with K elements whose sum… Read More »

## Subarray whose absolute sum is closest to K

Given an array of n elements and an integer K, the task is to find the subarray with minimum value of ||a[i] + a[i +… Read More »

## Number of sub arrays with odd sum

Given an array, find the number of subarrays whose sum is odd. Examples: Input : arr[] = {5, 4, 4, 5, 1, 3} Output :… Read More »