## 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 »

- Sliding Window Maximum (Maximum of all subarrays of size k) using stack in O(n) time
- Split the given array into K sub-arrays such that maximum sum of all sub arrays is minimum
- Greatest contiguous sub-array of size K
- Maximum length of subarray such that sum of the subarray is even
- Maximum Sum SubArray using Divide and Conquer | Set 2
- Find a subarray whose sum is divisible by size of the array
- Range Queries to Find number of sub-arrays with a given xor
- Maximum sum of non-overlapping subarrays of length atmost K
- Maximum subsequence sum such that all elements are K distance apart
- Number of ways to divide an array into K equal sum sub-arrays
- Count of triplets that satisfy the given equation
- Find minimum length sub-array which has given sub-sequence in it
- Maximize the subarray sum after multiplying all elements of any subarray with X
- Maximize the maximum subarray sum after removing atmost one element
- Maximum length sub-array which satisfies the given conditions
- Queries for number of distinct elements in a subarray | Set 2
- Sum of XOR of all sub-arrays of length K
- Maximum Subarray Sum after inverting at most two elements
- Find the number of sub arrays in the permutation of first N natural numbers such that their median is M
- Find array such that no subarray has xor zero or Y
- Longest Subarray having strictly positive XOR
- Maximize the size of array by deleting exactly k sub-arrays to make array prime
- Find all unique pairs of maximum and second maximum elements over all sub-arrays in O(NlogN)
- Maximum possible sub-array sum after at most X swaps
- Count the number of non-increasing subarrays
- Bitwise AND of sub-array closest to K
- 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
- Length of longest sub-array with maximum arithmetic mean.
- Longest sub-array with equal number of alphabets and numeric characters
- Maximise array sum after taking non-overlapping sub-arrays of length 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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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

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 »

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 »

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 »

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