CtCI-6th-Edition-Swift
CtCI-6th-Edition-Swift copied to clipboard
Combine `contains` and `insert` into one
https://github.com/careercup/CtCI-6th-Edition-Swift/blob/0dbf24e622df4ef8dbac383711c3b8629a87d477/Ch%202.%20Linked%20Lists/Ch%202.%20Linked%20Lists.playground/Pages/2.1%20Remove%20Duplicates.xcplaygroundpage/Contents.swift#L10-L11
Could be re-written as:
guard set.insert($1).inserted else { return $0 }
It's more canonical, and makes the value only need to get hashed once.