Coding question- leetcode stle

Implement a function findDuplicate(nums) that takes an array of integers nums containing n + 1 integers where each integer is between 1 and n (inclusive). There is only one duplicate number in the array, but it could appear multiple times.