1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-20 01:56:57 +02:00
LeetCode/problems/contains-duplicate.swift
Matej Focko 6c3cfcd876
chore: reorganize files
Signed-off-by: Matej Focko <mfocko@redhat.com>
2022-07-23 12:53:31 +02:00

12 lines
286 B
Swift

class Solution {
func containsDuplicate(_ nums: [Int]) -> Bool {
var encountered = Set<Int>()
for x in nums {
if encountered.contains(x) {
return true
}
encountered.insert(x)
}
return false
}
}