findDuplicate = function(nums, curr = 0) {
    const isBaseCase = curr === nums[curr]
    if (isBaseCase) return curr;

    const next = nums[curr];

    nums[curr] = curr;

    return findDuplicate(nums, next);/* Time O(N) | Space O(N) */
}
https://leetcode.com/problems/find-the-duplicate-number/
Time O(N) | Space O(N)
@param {number[]} nums
@return {number}