## Number of sub arrays with negative product

Given an array arr[] of N integers, the task is to find the count of subarrays with negative product. Examples: Input: arr[] = {-1, 2,… 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

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

Given an array arr[] of N integers and another integer K. The task is to find the maximum sum of a subsequence such that the… Read More »

Given an array arr[] of size N and an integer K, the task is to delete K continuous elements from the array such that the… Read More »

Given an array arr[] of N non-negative integers. The task is to count the number of triplets (i, j, k) where 0 ≤ i <… Read More »

Given an array of distinct integer A, the task is to count the number of possible permutations of the given array A[] such that the… Read More »

Given an array arr[] of N integers and Q queries. Each query can be represented by two integers L and R. The task is to… Read More »

Let represent the ordered pair of the second maximum and the maximum element of an array respectively. We need to find all such unique pairs… Read More »

Given two integers X (1 ≤ X ≤ 15) and Y. The task is to find an array of the maximum possible length N such… Read More »

Given a binary array arr[], the task is to find the length of the longest sub-array of the given array such that if the sub-array… Read More »

Given an array arr[] of N non-negative integers. The task is to find the length of the longest sub-array such that XOR of all the… Read More »

Given an array arr[] of integers and an integer K, the task is to find the greatest contiguous sub-array of size K. Sub-array X is… Read More »

Given an array arr[] of N elements, the task is to find the length of the smallest sub-array which has sequence {0, 1, 2, 3,… Read More »

Given an array of alphanumeric characters. The task is to find the longest contiguous sub-array which has equal numbers of letters (alphabets) and numbers (numeric… Read More »

Given an array arr[] of length N. The task is to check if there exists any subarray whose sum is a multiple of N. If… Read More »

Given an Array[] of N elements and a number K. ( 1 <= K <= N ) . Split the given array into K sub… Read More »