class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ return len(nums) != len(set(nums))
Nice python way tho.
However, it actually did more work than others' common code. Their process would mostly did less iterations, thus ending sooner than yours. You don't necessarily form up the whole set.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.