Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 390 Bytes

File metadata and controls

18 lines (11 loc) · 390 Bytes

115.Find All Duplicates in an Array

Description

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.

Find all the elements that appear twice in this array.

Example

Input: [4, 3, 2, 7, 8, 2, 3, 1]
Output: [2, 3]

From

LeetCode