Write a simple algorithm to check for duplicate entries in an array.
Implement contains_duplicate(nums), which accepts an array of integers and returns True if any value appears more than once, otherwise False. Aim for a single linear scan with additional memory proportional to the number of distinct values.
def contains_duplicate(nums):