## Number of subarrays whose minimum and maximum are same

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 »

- 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
- Count of triplets that satisfy the given equation
- Number of ways to divide an array into K equal sum sub-arrays
- 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
- Queries for number of distinct elements in a subarray | Set 2
- Maximize the maximum subarray sum after removing atmost one element
- Maximum length sub-array which satisfies the given conditions
- Maximum Subarray Sum after inverting at most two elements
- Sum of XOR of all sub-arrays of length K
- 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
- Find subarray with given sum with negatives allowed in constant space
- Length of longest sub-array with maximum arithmetic mean.
- 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
- Longest sub-array with equal number of alphabets and numeric characters

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 »

Given an array of integers. Write a program to find the K-th largest sum of contiguous subarray within the array of numbers which has negative… Read More »

Given an Array of positive numbers, calculate the number of possible contigous subarrays having product lesser than a given number K. Examples : Input :… Read More »

Given a array of n numbers. We need to count the number of subarrays having the product and sum of elements are equal Examples: Input… Read More »

Given an array, we need to find two subarrays with a specific length K such that sum of these subarrays is maximum among all possible… Read More »

Given an array of integers greater than zero, find if it is possible to split it in two subarrays (without reordering the elements), such that… Read More »

Given an array of integers, we need to get total XOR of all subarray XORs where subarray XOR can be obtained by XORing all elements… Read More »

You are given an array of positive and/or negative integers and a value K . The task is to find count of all sub-arrays whose… Read More »

Given an array of n positive integers and a positive integer k, the task is to find the maximum subarray size such that all subarrays… Read More »

Given an array, the task is to calculate the sum of lengths of contiguous subarrays having all elements distinct. Examples: Input : arr[] = {1,… Read More »