Maximum Product Subset Problem
Given an integer array, find a subset in it having the maximum product of its elements.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, find a subset in it having the maximum product of its elements.
Given an unsorted integer array, find all pairs with a given difference k in it without using any extra space.
Given an unsorted integer array, print all pairs with a given difference k in it.
Given a sorted array containing duplicates, efficiently find each element’s frequency without traversing the whole array.
Given an integer array, determine the index of an element before which all elements are smaller and after which all are greater.
Given an integer array, duplicates are present in it in a way that all duplicates appear an even number of times except one which appears an odd number of times. Find that odd appearing element in linear time and without using any extra memory.
Quickselect is a selection algorithm to find the k’th smallest element in an unordered list. It is closely related to the Quicksort sorting algorithm. Like Quicksort, it is efficient traditionally and offers good average-case performance, but has a poor worst-case performance.
The longest decreasing subsequence problem is to find a subsequence of a given sequence in which the subsequence’s elements are in sorted order, highest to lowest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous or unique.
Given a list containing future predictions of share prices, find the maximum profit earned by buying and selling shares at most twice with a constraint that a new transaction can only start after the previous transaction complete, i.e., we can only hold at most one share at a time.
Given a list containing future predictions of share prices, find the maximum profit earned by buying and selling shares at most k times with a constraint that a new transaction can only start after the previous transaction is complete, i.e., we can only hold at most one share at a time.
Given an unsorted integer array, print all distinct four elements tuple (quadruplets) in it, having a given sum.
4-sum problem: Given an unsorted integer array, check if it contains four elements tuple (quadruplets) having a given sum.