Write a function to find duplicates in an array and explain your approach.
Implement find_duplicates(nums). Return a list containing each value that appears more than once, included only once and ordered by the first time its repetition is detected.
Input is a list of integers. Return an empty list when no value is duplicated.
Signature: def find_duplicates(nums):
def find_duplicates(nums):