Contains Duplicate
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
Example
Input: [1,2,3,1]
Output: true
Solution
class Solution:
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
num_list = set()
for num in nums:
if num in num_list:
return True
else:
num_list.add(num)
return False