Find All Duplicates in an Array Problem

Find All Duplicates in an Array Problem — ExecCode Medium DSA Practice

Solve the Find All Duplicates in an Array problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Find All Duplicates in an Array: Mark index abs(x)-1 negative; second hit → duplicate. For Find All Duplicates in an Array, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input nums = [4, 3, 2, 7, 8, 2, 3, 1]; Output [2, 3]

Constraints

1 ≤ n ≤ 10^5 Values fit in 32-bit ints

Practice Find All Duplicates in an Array free on ExecCode. Browse DSA problems, topic map, and placement guides.