How to find Duplicate Elements in Array? I have array of phone numbers so in the phone numbers i should start searching from the right side to the left side and find similar
extension Array where Element: Hashable { func similar() -> Self { var used = [Element: Bool]() return self.filter { used.updateValue(true, forKey: $0) != nil } } }