':type nums: List[int]
:rtype: int'

def findDuplicate(self, nums):

    duplicate = 0
    for num in nums:
        if (nums[(abs(num) - 1)] > 0):
            nums[(abs(num) - 1)] *= (-1)
        else:
            duplicate = abs(num)
            break
    for num in nums:
        if (nums[(abs(num) - 1)] < 0):
            nums[(abs(num) - 1)] *= (-1)
        else:
            break
    return duplicate
