public func solution(_ A : inout [Int]) -> Int { var suspect = 1 // the lowest possible value var B = Array(Set(A)) // eliminate duplicates B.sort() // order the data for x in B { // enumerate if (x > 0) { // only care about positive ints if (x != suspect) { // expected int is missing return suspect // eureka! } suspect = x+1 // expect the next highest int } } return suspect }