## Find the Kth smallest element in the sorted generated array

Given an array arr[] of N elements and an integer K, the task is to generate an B[] with the following rules: Copy elements arr[1…N],… Read More »

## Minimum operations to make sum of neighbouring elements <= X

Given an array arr[] of N elements and an integer X, the task is to find the minimum number of operations required to make sum… Read More »

## Queries for number of distinct elements from a given index till last index in an array

Given a array ‘a[]’ of size n and number of queries q. Each query can be represented by a integer m. Your task is to… Read More »

## Convert many to many mappings to maximum no of one to one mappings

Given an array arr1 containing integers from 1..N and another array arr2 containing integers from 1..M. Each element of arr1 is mapped to more than… Read More »

## Order of indices which is lexicographically smallest and sum of elements is <= X

Given an array arr[] and an integer X, the task is to find the indices such that: The sum of elements on the found indices… Read More »

## Count common elements in two arrays containing multiples of N and M

Given two arrays such that the first array contains multiples of an integer n which are less than or equal to k and similarly, the… Read More »

## Find if a binary matrix exists with given row and column sums

Given an array Row[] of size R where Row[i] is the sum of elements of the ith row and another array Column[] of size C… Read More »

## Create a Sorted Array Using Binary Search

Given an array, the task is to create a new sorted array in ascending order from the elements of the given array. Examples: Input :… Read More »

## Length of longest sub-array with maximum arithmetic mean.

Given an array of n-elements find the longest sub-array with the greatest arithmetic mean. The length of the sub-array must be greater than 1 and… Read More »

## Check whether a subsequence exists with sum equal to k if arr[i]> 2*arr[i-1]

Given a sorted array of positive integers where arr[i] > 2*arr[i-1], check whether a sub sequence exists whose sum is equal to k. Examples: Input… Read More »

## Check whether we can sort two arrays by swapping A[i] and B[i]

Given two arrays, we have to check whether we can sort two arrays in strictly ascending order by swapping A[i] and B[i]. Examples: Input :… Read More »

## Find the largest possible k-multiple set

Given an array containing distinct positive integers and an integer k. The task is to find the largest possible k-multiple set from the array of… Read More »

## Convert given integer X to the form 2^N – 1

Given an integer x. The task is to convert x to the form 2n – 1 by performing the following operations in specified order on… Read More »

## Maximum distance between two unequal elements

Given an array arr[], the task is to find the maximum distance between two unequal elements of the given array. Examples: Input: arr[] = {3,… Read More »

## Find the lexicographical next balanced bracket sequence

Given a balanced bracket sequence as a string str containing character ‘(‘ or ‘)’, the task is to find the next lexicographical order balanced sequence… Read More »