Array filtering: [1,1,2,3,3,4] → [1,1,3,3]
Asked in the Round 2 technical + system design (Tech Manager) stage.
Implement filter_repeated(nums). Return a new array containing every occurrence of each value whose total frequency is greater than one. Preserve the relative order of the retained elements. Values that occur exactly once must be removed.
nums.def filter_repeated(nums):