Find all duplicate elements in a limited range array
Find the duplicate numbers in an integer array of size n that contains elements between 1 and n, at least one of which repeats.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedFind the duplicate numbers in an integer array of size n that contains elements between 1 and n, at least one of which repeats.
Given four integer arrays, count the number of quadruplets with a zero sum, including exactly one element from each array.
Given a string, find the length of the longest palindrome possible from its characters.
Given a binary tree and an integer k, count the total number of paths in the tree whose sum of all nodes is equal to k.
Given two strings, check if the second string can be constructed from characters of the first string, where each character of the first string can be used only once in the second string.
Given an unsorted integer array, find the smallest missing positive integer in it.
Given a linked list containing a loop, remove the loop from it.
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 two linked lists, where the tail of the second list points to a node in the first list, find the node where both lists intersect.
Given a string and a positive integer k, find all distinct substrings of any length containing exactly k distinct characters.
Given an integer array, find the length of the longest subsequence formed by the consecutive integers. The subsequence should contain all distinct values, and the character set should be consecutive, irrespective of its order.