Find the minimum and maximum element in an array using minimum comparisons
Given an integer array, find out the minimum and maximum element present using minimum comparisons.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, find out the minimum and maximum element present using minimum comparisons.
Given an integer array, find the maximum sum among all subarrays possible using divide and conquer algorithm.
Given an array, find the peak element in it. A peak element is an element that is greater than its neighbors. There might be multiple peak elements in an array, and the solution should report any peak element.
Given a sorted binary array, efficiently find the total number of 1’s in it.
Given a nearly sorted array such that each of the n elements may be misplaced by no more than one position from the correct sorted order, search a given element in it efficiently. Report if the element is not present in the array.
Given a sorted integer array, find the floor and ceil of a given number in it. The floor and ceil map the given number to the largest previous or the smallest following integer.
Given a sorted array of distinct non-negative integers, find the smallest missing element in it.
Given a sorted integer array containing duplicates, count occurrences of a given number. If the element is not found in the array, report that as well.
Given a sorted integer array, find the index of a given number’s first or last occurrence. If the element is not present in the array, report that as well.
Given a circularly sorted integer array, search an element in it. Assume there are no duplicates in the array, and the rotation is in the anti-clockwise direction.
Given a sorted array of distinct positive integers, print all triplets that forms an arithmetic progression with an integral common difference.
Given a circularly sorted integer array, find the total number of times the array is rotated. Assume there are no duplicates in the array, and the rotation is in the anti-clockwise direction.