Given an array of unsorted integers, write an efficient algorithm to find duplicate values using a hash-based approach.
Return each duplicated value once, in the order it is encountered as a duplicate. Define a function that accepts a list of integers and returns a list of integers. Use average O(n) time and O(n) additional space.
def find_duplicates(nums):