## Find the index of the element in an array which divides most elements before it

Given an array arr, the task is to find the index of the element in an array which divides most elements before it Examples: Input:… Read More »

## Minimum changes required to make all element in an array equal

Given an array of length N, the task is to find minimum operation required to make all elements in the array equal. Operation is as… Read More »

## Maximize distance between any two consecutive 1’s after flipping M 0’s

Given the size of a binary array consisting of 0’s only as n and an integer m which is the number of flips allowed from… Read More »

## Find the smallest subarray having atleast one duplicate

Given an array arr of N elements, the task is to find the length of the smallest subarray of the given array that contains at… Read More »

## Find the distance between two person after reconstruction of queue

Given a 2D array of size N containing distinct height of people standing in a queue, and a number corresponding to each person (P) that… Read More »

## Find last two remaining elements after removing median of any 3 consecutive elements repeatedly

Given a sequence A1, A2, A3, … An of distinct integers. The task is to find the last 2 remaining elements after removing the median… Read More »

## Size of the largest divisible subset in an Array

Given an array arr[] of size N. The task is to find the size of the set of numbers from the given array such that… Read More »

## Make all elements zero by decreasing any two elements by one at a time

Given an array arr[], the task is to check whether it is possible to make all the elements of the array zero by the given… Read More »

## Subarray permutation that satisfies the given condition

Given a permutation of integers from 1 to N and an integer M, the task is to check if any subarray of the given permutation… Read More »

## Maximum XOR value of maximum and second maximum element among all possible subarrays

Given an array arr[] of N distinct positive integers, let’s denote max(i, j) and secondMax(i, j) as the maximum and the second maximum element of… Read More »

## Number of cells in matrix which are equidistant from given two points

Given a matrix of N rows and M columns, given two points on the matrix; the task is to count the number of cells that… Read More »

## Minimize the sum of differences of consecutive elements after removing exactly K elements

Given a sorted array of length ‘N’ and an integer ‘K'(K<N), the task is to remove exactly 'K' elements from the array such that sum… Read More »

## Longest sub-array with maximum GCD

Given an array arr[] of length N, the task is the find the length of the longest sub-array with maximum possible GCD value. Examples: Input:… Read More »

## Count number of pairs (i, j) such that arr[i] * arr[j] = arr[i] + arr[j]

Given an array arr[] of length N, count the number of pairs (i, j) such that arr[i] * arr[j] = arr[i] + arr[j] and 0… Read More »

## Check if all the elements can be made of same parity by inverting adjacent elements

Given a binary matrix. In a single operation, you are allowed to choose two adjacent elements and invert their parity. The operation can be performed… Read More »