Given an array containing values from 1 to n, return all values that appear twice. Cyclic placement shows duplicates as values that cannot be placed in their home positions.
nums = array of integers from 1 to n
all duplicated values
Example 1:
Input:
nums = [4,3,2,7,8,2,3,1]
Output:
[2,3]
Explanation:
2 and 3 appear twice.
Example 2:
Input:
nums = [1,1,2]
Output:
[1]
Explanation:
1 is the only duplicate.