## Sum of maximum of all subarrays | Divide and Conquer

Given an array arr[] of length N, the task is to find the sum of the maximum elements of every possible sub-array of the array.… Read More »

- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Number of subarrays have bitwise OR >= K
- Count sub-arrays whose product is divisible by k
- Range and Update Sum Queries with Factorial
- Lazy Propagation in Segment Tree | Set 2
- Queries for Composite numbers in subarray (With Point Updates)
- Queries to update a given index and find gcd in range
- Maximize the summation of numbers in a maximum of K moves in range [L, R]
- Find the number of different numbers in the array after applying the given operation q times
- Index of kth set bit in a binary array with update queries

Given an array arr[] of length N, the task is to find the sum of the maximum elements of every possible sub-array of the array.… Read More »

Given an array of size N, initially consists of zeroes only. The task is to apply given operation q times and find the number of… Read More »

Given a binary array arr[] and q queries of following types: k: find the index of the kth set bit i.e. kth 1 in the… Read More »

Given an array arr[] of N integers and queries Q. Queries are of two types: Update a given index ind by X. Find the gcd… Read More »

Given an array arr[] of size N. There are two types of operations: Update(l, r, x) : Increment the a[i] (l <= i <= r)… Read More »

Given an integer K and an array arr[], the task is to count all the sub-arrays whose product is divisible by K. Examples: Input: arr[]… Read More »

Given an unsorted array, trim the array such that twice of minimum is greater than the maximum in the trimmed array. Elements should be removed… Read More »

Given an array arr[] of N integers and Q queries. Each query consists of 3 integers L, R and K. You can move from index… Read More »

Given an array arr[] and an integer K, the task is to count the number of sub-arrays having bitwise OR ≥ K. Examples: Input: arr[]… Read More »

Given an array of N integers, the task is to perform the following two operations on the given array: query(start, end) : Print the number… Read More »

Given an array arr[] of N integers and number of queries Q. The task is to answer three types of queries. Update [l, r] –… Read More »

Given an array of integers arr, the task is to count the number of inversions in the array. If A[i] > A[j] and i <… Read More »

Given an array ‘arr’ all the numbers of which are initialized to ‘0’ then the array can be updated at any time in the following… Read More »

Pre-requisites: Segment Tree Given an array of digits arr[]. Given a number of range [L, R] and a digit X with each range. The task… Read More »

Given an array arr[0 . . . n-1]. The task is to perform the following operation: Find the maximum of elements from index l to… Read More »