Day 13 LeetCode
👨‍💻

Day 13 LeetCode

Tags
Data Structures
Python
Java
Computer Science
Published
Jan 24, 2021

Day 13 Task:

  1. Contains Duplicate: https://leetcode.com/problems/contains-duplicate/

Solution:

Please review all the solutions and try implementing on your own if you haven’t gotten it.
class Solution:
    def containsDuplicate(self, nums: List[int]) -> bool:
        ht= {}
        for num in nums:
            if(num not in ht):
                ht[num] = 1
            else:
                return True
        return False