Minimum Numbers of cells that are connected with the smallest path between 3 given cells

Given coordinates of 3 cells (X1, Y1), (X2, Y2) and (X3, Y3) of a matrix. The task is to find the minimum path which connects… Read More »

Number of pairs whose sum is a power of 2

Given an array arr[] of positive integers, the task is to count the maximum possible number of pairs (arr[i], arr[j]) such that arr[i] + arr[j]… Read More »

Python | Sort list of list by specified index

We can sort list of list using the conventional sort function. This sorts the list by the first index of lists. But more than often… Read More »

Smallest subarray containing minimum and maximum values

Given an array A of size N. The task is to find the length of smallest subarray which contains both maximum and minimum values. Examples:… Read More »

Sort the array of strings according to alphabetical order defined by another string

Given a string str and an array of strings strArr[], the task is to sort the array according to the alphabetical order defined by str.… Read More »

Minimum number of consecutive sequences that can be formed in an array

Given an array of integers. The task is to find the minimum number of consecutive sequences that can be formed using the elements of the… Read More »

Leftmost and rightmost indices of the maximum and the minimum element of an array

Given an array arr[], the task is to find the leftmost and the rightmost indices of the minimum and the maximum element from the array… Read More »

Average of remaining elements after removing K largest and K smallest elements from array

Given an array of N integers. The task is to find the average of the numbers after removing k largest elements and k smallest element… Read More »

Sort the array in a given index range

Given an array arr[] of N integers and an index range [a, b]. The task is to sort the array in this given index range… Read More »

Sort an array of string of dates in ascending order

Given an array of strings dates[], the task is to sort these dates in ascending order. Note: Each date is of the form dd mmm… Read More »

Maximum sum by picking elements from two arrays in order

Given two arrays of size N and two integers X and Y indicating the maximum number of elements one can pick from array A and… Read More »

Check if words are sorted according to new order of alphabets

Given a sequence of Words and the Order of the alphabet. The order of the alphabet is some permutation of lowercase letters. The task is… Read More »

Ceiling of every element in same array

Given an array of integers, find the closest smaller or same element for every element. If all elements are greater for an element, then print… Read More »

Floor of every element in same array

Given an array of integers, find the closest smaller or same element for every element. If all elements are greater for an element, then print… Read More »

Minimum range increment operations to Sort an array

Given an array containing N elements. It is allowed to do the below move any number of times on the array: Choose any L and… Read More »