Given an array as the input, the output of this method should be an array containing numbers that have duplicates in the original array. The order of the elements in the final array does not matter.
input: [5, 5, 6, 7, 8, 8, 7, 9, 9]
output: [5, 7, 8, 9]
or [7, 5, 9, 8]
or any permutation of the four numbers.