## Remove elements to make array satisfy arr[ i+1] < arr[i] for each valid i

Given an array arr[] of non-negative integers. We have to delete elements from this array such that arr[i + 1] > arr[j] for each valid… Read More »

## Queries for bitwise AND in the index range [L, R] of the given array

Given an array arr[] of N and Q queries consisting of a range [L, R]. the task is to find the bit-wise AND of all… Read More »

## Find number from its divisors

Given an array arr[] of N integers. The integers represent all the divisors of a number X except 1 and X itself. The task is… Read More »

## Queries for bitwise OR in the index range [L, R] of the given array

Given an array arr[] of N and Q queries consisting of a range [L, R]. the task is to find the bit-wise OR of all… Read More »

## Find the index which is the last to be reduced to zero after performing a given operation

Given an integer array arr[] of size N and an integer K, the task is to find the index which will be the last to… Read More »

## Queries to find the maximum Xor value between X and the nodes of a given level of a perfect binary tree

Given a perfect binary tree of N nodes, with nodes having values from 1 to N as depicted in the image below and Q queries… Read More »

## Minimize the number of steps required to reach the end of the array | Set 2

Given an integer array arr[] of length N consisting of positive integers, the task is to minimize the number of steps required to reach the… Read More »

## Count index pairs which satisfy the given condition

Given a permutation P of first N natural numbers, the task is to count the index pairs (i, j) such that P[i] + P[j] =… Read More »

## Maximum sum such that no two elements are adjacent | Set 2

Given an array of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be… Read More »

## Minimize the number of steps required to reach the end of the array

Given an integer array arr[] of length N consisting of positive integers, the task is to minimize the number of steps required to reach the… Read More »

## Find the largest interval that contains exactly one of the given N integers.

Given an array arr[] of N distinct integers, the task is to find the maximum elements in an interval [L, R] such that the interval… Read More »

## Optimal Strategy for a Game | Set 2

Problem statement: Consider a row of n coins of values v1 . . . vn, where n is even. We play a game against an… Read More »

## Maximize the size of array by deleting exactly k sub-arrays to make array prime

Given an array arr[] of N positive integers and a non negative integer K. The task is to delete exactly K sub-arrays from the array… Read More »

## Bitwise AND of sub-array closest to K

Given an integer array arr[] of size N and an integer K, the task is to find the sub-array arr[i….j] where i ≤ j and… Read More »

## Sort an array according to count of set bits | Set 2

Given an array arr[] of positive integers, the task is to sort the array in decreasing order of count of set bits in binary representations… Read More »