## 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… 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 »

## Maximum possible sum after M operations on N cards

Given an array arr[] of size N which represents the initial number on each card and given a two dimensional array B[][] of size M… Read More »

## Maximum possible GCD after replacing at most one element in the given array

Given an array arr[] of size N > 1. The task is to find the maximum possible GCD of the array by replacing at most… Read More »

## Maximum possible array sum after performing the given operation

Given an array arr[] of size N, the task is to find the maximum sum of the elements of the array after applying the given… Read More »