Group Duplicate Numbers by First Occurrence Order

Medium algorithms interview practice: Group Duplicate Numbers by First Occurrence Order.

Given an array of numbers, return a new array containing only the numbers that appear more than once, with all instances of each duplicate grouped together. The groups should be ordered by when each number first became a duplicate (i.e., when its second occurrence appeared). For example: `[1,5,3,2,4,2,3,1,2,3,2,4]`