Find the duplicates in a list in the order they appear.
Asked in the R2 Technical Managerial stage. Python coding question.
Write a function that takes a list of integers and returns the duplicate values in the order they are first detected as duplicates. A value should appear in the output only the first time it repeats, even if it occurs more than twice.
def find_duplicates(nums):
nums: a list of integersdef find_duplicates(nums):