Write a function to identify duplicate values in an array and discuss the time and space complexity of your approach.