Find the maximum difference between two array elements that satisfies the given constraints
Given an integer array, find the maximum difference between two elements in it such that the smaller element appears before the larger element.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, find the maximum difference between two elements in it such that the smaller element appears before the larger element.
The Longest Bitonic Subarray (LBS) problem is to find a subarray of a given sequence in which the subarray’s elements are first sorted in increasing order, then in decreasing order, and the subarray is as long as possible.
Given an integer array, find the largest subarray formed by consecutive integers. The subarray should contain all distinct values.
Given a limited range array of size n and containing elements between 1 and n-1 with one element repeating, find the duplicate number in it without using any extra space.
Given an integer array, replace each element with the product of every other element without using the division operator.
Given an integer array, find the maximum product of two integers in it. For example, consider array {-10, -3, 5, 6, -2}. The maximum product is the (-10, -3) or (5, 6) pair.
Given a binary array, find the index of 0 to be replaced with 1 to get the maximum length sequence of continuous ones.
Given a binary array containing 0 and 1, find a maximum length subarray with equal numbers of 0’s and 1’s.
Given an integer array, find the maximum length subarray having a given sum.
Given an array of integers, check if the array contains a sub-arrays with 0-sum. Also, prints end-points of all such sub-arrays…
Given two sorted arrays X[] and Y[] of size m and n each where m >= n and X[] has exactly n vacant cells, merge elements of Y[] in their correct position in array X[], i.e., merge (X, Y) by keeping the sorted order.
Given two sorted arrays, X[] and Y[] of size m and n each, merge elements of X[] with elements of array Y[] by maintaining the sorted order, i.e., fill X[] with the first m smallest elements and fill Y[] with remaining elements.