Find the missing term in a sequence in logarithmic time
Given a sequence of n numbers such that the difference between the consecutive terms is constant, find the missing term in logarithmic time.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a sequence of n numbers such that the difference between the consecutive terms is constant, find the missing term in logarithmic time.
Given an integer array, find subarrays with a given sum in it.
Given a set S, generate all distinct subsets of it, i.e., find a distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
Given a sorted integer array, find the floor and ceiling of a given number in it. The floor and ceiling map the given number to the largest previous or the smallest following integer.
In the k–partition problem, we need to partition an array of positive integers into k disjoint subsets that all have an equal sum, and they completely cover the set.
Given a set S of positive integers, determine if it can be partitioned into three disjoint subsets that all have the same sum, and they cover S.
This post will sort an integer array using the iterative merge sort algorithm. Merge sort is an efficient sorting algorithm that falls under the Divide and Conquer paradigm and produces a stable sort.
Given an unsorted integer array of size n, whose elements lie in the range 0 to n-1, rearrange the array such that A[A[i]] is set to i for every array element A[i].
Given an integer array, duplicates appear in it an even number of times except for two elements, which appear an odd number of times. Find both odd appearing elements without using any extra memory.
Given an array representing a min-heap, convert it into a max-heap. The conversion should be done in-place and in linear time.
Given an array, reverse every group of consecutive m elements in a given subarray of it.
Given an integer array, find all distinct combinations of a given length k. The program should print only distinct combinations.