Hyoseo Lee
01 Index 02 Current page Writing 03 Work 04 Notes 05 Games 06 Author
leetcode

217. Contains Duplicate

Topic Hash Table
Area Algorithms
Summary
I hate C

Problem

View on LeetCode →

Difficulty: Easy
Tags: Array, Hash Table, Sorting

Intuition

internet is dumb

Approach

I hate C

Solution

class Solution:
    def containsDuplicate(self, nums: list[int]) -> bool:
        return len(nums) != len(set(nums))

Complexity

  • Time: O(n)O(n)

  • Space: O(n)O(n)