## Minimum cells to be flipped to get a 2*2 submatrix with equal elements

Given a matrix of size M * N, the task is to find the count of the minimum number of cells that must be flipped… Read More »

## Permute the elements of an array following given order

A permutation is a rearrangement of members of a sequence into a new sequence. For example, there are 24 permutations of [a, b, c, d].… Read More »

## Queries for elements greater than K in the given index range using Segment Tree

Given an array arr[] of N elements and a number of queries where each query will contain three integers L, R and K. For each… Read More »

## Cyclic Iterator for K variable length vectors

Given K vectors, the task is to design a cyclic iterator that prints the elements of these vectors in a cyclic manner. For example: v1… Read More »

## Maximum sum subarray after altering the array

Given an array arr[] of size N. The task is to find the maximum subarray sum possible after performing the given operation at most once.… Read More »

## Find the count of distinct numbers in a range

Given an array of size N containing numbers only from 0 to 63, and you are asked Q queries regarding it. Queries are as follows:… Read More »

## Restore a permutation from the given helper array

Given an array Q[] of size N – 1 such that each Q[i] = P[i + 1] – P[i] where P[] is the premutation of… Read More »

## Find the maximum amount that can be collected by selling movie tickets

Given an integer N and an array seats[] where N is the number of people standing in a line to buy a movie ticket and… Read More »

## Calculate the Sum of GCD over all subarrays

Given an array of integers, the task is to calculate the sum of GCD of all the subarrays of an array. GCD of an array… Read More »

## Multiplication on Array : Range update query in O(1)

Consider an array A[] of integers and the following two types of queries. update(l, r, x): multiply x to all values from A[l] to A[r]… Read More »

## Sort an Increasing-Decreasing Array

Given a K-increasing-decreasing array arr[], the task is to sort the given array. An array is said to be K-increasing-decreasing if elements repeatedly increase upto… Read More »

## Longest Increasing Subsequence using BIT

Given an array arr, the task is to find the length of Longest Increasing Sequence using Binary Indexed Tree (BIT) Examples: Input: arr = {6,… Read More »

## Minimum cost to reverse edges such that there is path between every pair of nodes

Given a connected, directional graph. Each node is connected to exactly two other nodes. There is weight associated with each edge denoting the cost to… Read More »

## Count of indices in an array that satisfy the given condition

Given an array arr[] of N positive integers, the task is to find the count of indices i such that all the elements from arr[0]… Read More »

## Minimum inversions required so that no two adjacent elements are same

Given a binary array arr[] of size N. The task is to find the minimum number of inversions required so that no two adjacent elements… Read More »