Problem
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Algorithm
Sort and compare the adjacent elements.
Code
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
nLen = len(nums)
nums.sort()
for i in range(1, nLen):
if nums[i] == nums[i-1]:
return True
return False