from typing import List class Solution: def hasDuplicate(self, nums: List[int]) -> bool: if len(nums) == 0: return False res = dict() for entry in nums: is_dublicate = res.get(entry) if is_dublicate: return True res[entry] = True return False input_1 = [1, 2, 3, 3] input_2 = [1, 2, 3, 4] input_3 = [] input_4 = [0] input_5 = [1, 2, 2, 2, 2, 3, 1, 1] sol = Solution() print(sol.hasDuplicate(input_1)) print(sol.hasDuplicate(input_2)) print(sol.hasDuplicate(input_3)) print(sol.hasDuplicate(input_4)) print(sol.hasDuplicate(input_5))