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

- Check whether an Array is Subarray of another Array
- Length of the longest Subarray with only Even Elements
- Generating subarrays using recursion
- Sum of minimum elements of all subarrays
- Longest Subarray with Sum greater than Equal to Zero
- Subarray of size k with given sum
- Length of the longest alternating subarray
- Find the sums for which an array can be divided into sub-arrays of equal sum
- Check if array can be divided into two sub-arrays such that their absolute difference is K
- Length of largest sub-array having primes strictly greater than non-primes
- Subarray whose absolute sum is closest to K
- Smallest Integer to be inserted to have equal sums
- Smallest subarray such that all elements are greater than K
- Count subarrays with Prime sum
- Maximum sum subarray such that start and end values are same
- Maximize the number of subarrays with XOR as zero
- Count subarrays with all elements greater than K
- Check if subarray with given product exists in an array
- Longest Prime Subarray after removing one element
- Find the longest Fibonacci-like subarray of the given array
- Number of sub-arrays that have at least one duplicate
- Longest subarray with elements divisible by k
- Count Subarrays with Consecutive elements differing by 1
- Largest sub-array whose all elements are perfect squares
- Longest subarray having difference in the count of 1's and 0's equal to k
- Find the count of Strictly decreasing Subarrays
- Maximum size of sub-array that satisfies the given condition
- Maximize the maximum among minimum of K consecutive sub-arrays
- Check if all sub-numbers have distinct Digit product
- Maximum number of contiguous array elements with same number of set bits

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 »

Given an array containing N integers. The task is to find the sum of the elements of the contiguous subarray having the smallest(minimum) sum. Examples:… Read More »

Given an array of N numbers where a subarray is sorted in descending order and rest of the numbers in the array are in ascending… Read More »

Given an array of size N and Q queries, each query consists of L, R, and K(consider 1 based-indexing for L and R). The task… Read More »

Given an array of N positive integers, the task is to find the smallest positive integer that can be placed between any two elements of… Read More »

Given, an array of size N. Find an element which divides the array into two sub-arrays with equal product. Print -1 if no such partition… Read More »

Given an array A[] that contains both positive and negative integers, find the maximum product subarray. Examples : Input: A[] = { 6, -3, -10,… Read More »

Given an array and two numbers M and K. We need to find sum of max M subarrays of size K (non-overlapping) in the array.… Read More »

Given an array of n-positive elements. Sub-array sum is defined as the sum of all elements of a particular sub-array, the task is to find… Read More »

Given an array and limits (lower and upper limits), check the sum of the subarray in the given limit is prime or not Examples :… Read More »

Given an array of N non-negative integers, task is to find the maximum size of a subarray such that the pairwise sum of the elements… Read More »

Given an array A of size N, and a number K. Task is to find out if it is possible to partition the array A… Read More »

Given an array of N integers, count number of even-odd subarrays. An even – odd subarray is a subarray that contains the same number of… Read More »

Given an array of n integers, find the no of subarrays whose minimal and maximum elements are same. Subarray is defined as non-empty sequence of… Read More »