Given an array of integers, how would you move the

Interview Answer

3 Answers

▲

10

▼

In Java I'd do this using a hashset and newly created array(of dups). Simply iterate over the array checking first to see if the value already existed in the hashset. If it already exists add to array(of dups) if not add to hashset.