본문 바로가기
python-algorithm

leetcode 217. Contains Duplicate

by 무적김두칠 2022. 3. 24.

1
2
3
4
5
6
class Solution:
    def containsDuplicate(self, nums: List[int]) -> bool:
        ans=False
        numsSet=list(set(nums))
        if sorted(nums) != sorted(numsSet) : ans=True
        return ans
cs
반응형

댓글