Find the smallest missing positive number from an unsorted array
Given an unsorted integer array, find the smallest missing positive integer in it.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an unsorted integer array, find the smallest missing positive integer in it.
Given an array A, find the maximum value of j – i such that A[j] > A[i].
Given an integer array, truncate it such that 2×min becomes more than max, and the total number of removals is minimal. The elements can be removed either from the start or end of the array if the above condition does not meet.
Given a list of departure and arrival airports, find the itinerary in order. It may be assumed that departure is scheduled from every airport except the final destination, and each airport is visited only once.
Given an integer array, determine if it can be divided into pairs such that the sum of elements in each pair is divisible by a given integer k.
Given an integer array, find the previous smaller element for every array element. The previous smaller element of a number x is the first smaller number to the left of x in the array.
Given an array, count the total number of triplets, which leads to an inversion. If (i < j < k) and (A[i] > A[j] > A[k]), then we can say that triplet (i, j, k) formed an inversion in an array A.
Given n ropes of different lengths, connect them into a single rope with minimum cost. Assume that the cost to connect two ropes is the same as the sum of their lengths.
Given a circularly sorted integer array, find a pair with a given sum. Assume there are no duplicates in the array, and the rotation is in an anti-clockwise direction around an unknown pivot.
Given a level order representation of a complete binary search tree, print its elements in increasing order.
Given a circular integer array, find the next greater element for every element in it. The next greater element of an element x in the array is the first larger number to the next of x.
Given an integer array, find the next greater element for every array element. The next greater element of a number x is the first greater number to the right of x in the array.