# Tag Archives: subarray

## Count ways to split array into two equal sum subarrays by changing sign of any one array element

Given an array arr[] consisting of N integers, the task is to count ways to split array into two subarrays of equal sum by changing… Read More »

## Check if any subarray can be made palindromic by replacing less than half of its elements

Given an array arr[] of size N, the task is to check if any subarray from the given array can be made a palindrome by… Read More »

## Minimum flips of odd indexed elements from odd length subarrays to make two given arrays equal

Given two binary arrays X[] and Y[] of size N, the task is to convert array X[] into array Y[] by minimum number of operations… Read More »

## Minimum subarray reversals required to make given binary array alternating

Given a binary array arr[] consisting of equal count of 0s and 1s, the task is to count the minimum number of subarray reversal operations… Read More »

## Check if a non-contiguous subsequence same as the given subarray exists or not

Given an array arr[] consisiting of N integers and two integer values L and R, indicating the starting and ending indices of a subarray, the… Read More »

## Longest subarray in which all elements are smaller than K

Given an array arr[] consisting of N integers and an integer K, the task is to find the length of the longest subarray in which… Read More »

## Count subarrays having an equal count of 0s and 1s segregated

Given a binary array arr[], the task is to count the number of subarrays having equal count of 0s and 1s, and all the 0s… Read More »

## Smallest pair of indices with product of subarray co-prime with product of the subarray on the left or right

Given an array arr[] of length N, the task is to find the smallest pair of indices (i, j) such that the product of elements… Read More »

## Count ways to split array into two subarrays with equal GCD

Given an array, arr[] of size N, the task is to count the number of ways to split given array elements into two subarrays such… Read More »

## Longest subarray in which all elements are a factor of K

Given an array A[] of size N and a positive integer K, the task is to find the length of the longest subarray such that… Read More »

## Reduce array to longest sorted array possible by removing either half of given array in each operation

Given an array arr[] of size N (always power of 2), the task is to find the length of the longest sorted array to which… Read More »

## Count ways to split array into two equal sum subarrays by replacing each array element to 0 once

Given an array arr[] consisting of N integers, the task is to count the number of ways to split the array into two subarrays of… Read More »

## Length of longest subarray having frequency of every element equal to K

Given an array arr[] consisting of N integers and an integer K, the task is to find the length of the longest subarray such that… Read More »

## Queries to check if count of increasing and decreasing subarrays is same in given range

Given an array arr[] consisting of N integers and an array Q[][], where each row is a query of the form {L, R}. The task… Read More »

## Rearrange array elements excluded by given ranges to maximize sum of subarrays starting from the first index

Given an array arr[] consisting of N integers and an array Q[][], where each row denotes a range {l, r}(0 ≤ l ≤ r ≤… Read More »