## Check if a number from every row can be selected such that xor of the numbers is greater than zero

Given a 2-D array of order N X M array elements, the task is to check if we can select a number from every row… Read More »

## Find the original matrix when largest element in a row and a column are given

Given two arrays A[] and B[] of N and M integers respectively. Also given is a N X M binary matrix where 1 indicates that… Read More »

## Find the maximum possible value of a[i] % a[j] over all pairs of i and j

Given an array arr[] of N positive integers. The task is to find the maximum possible value of a[i] % a[j] over all pairs of… Read More »

## Find the number of divisors of all numbers in the range [1, n]

Given an integer N. The task is to find the number of divisors of all the numbers in the range [1, N]. Examples: Input: N… Read More »

## Find the number of sub arrays in the permutation of first N natural numbers such that their median is M

Given an array arr[] containing the permutation of first N natural numbers and an integer M ≤ N. The task is to find the number… Read More »

## Program to find the maximum difference between the index of any two different numbers

Given an array of N integers. The task is to find the maximum difference between the index of any two different numbers. Note that there… Read More »

## Interactive Problems in Competitive Programming

Interactive Problems are those problems in which our solution or code interacts with the judge in real time. When we develop a solution for an… Read More »

## Find the minimum number of operations required to make all array elements equal

Given an array arr[] of size N. The task is to make all the array elements equal by applying the below operations minimum number of… Read More »

## Convert the undirected graph into directed graph such that there is no path of length greater than 1

Given an undirected graph with N vertices and M edges and no self loops or multiple edges. The task is to convert the given undirected… Read More »

## Lazy Propagation in Segment Tree | Set 2

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 »

## Find n positive integers that satisfy the given equations

Given three integers N, X and Y. The task is to find N positive integers that satisfy the given equations. a12 + a22 + ….… Read More »

## Find (1^n + 2^n + 3^n + 4^n) mod 5 | Set 2

Given a very large number N. The task is to find (1n + 2n + 3n + 4n) mod 5. Examples: Input: N = 4… Read More »

## Minimum number of given operations required to convert a permutation into an identity permutation

Given a permutation P (P1, P2, P3, … Pn) of first n natural numbers. Find the minimum number of operations to convert it into an… Read More »

## Find original numbers from gcd() every pair

Given an array arr[] containing GCD of every possible pair of elements of another array. The task is to find the original numbers which are… Read More »

## Element in a matrix starting from which anti-clockwise traversal ends at the last element

Given a mat[][] of size n X n, the task is to find an element X such that if the anti-clockwise traversal is begun from… Read More »