Suggested approach: This is a bit like computer science 101, so start by answering with the facts: sets can’t contain duplicates and are unordered, so lookup is significantly faster. Note: this might sound like a trivial question, but the "significantly faster" part is critical – sets can be thousands of times faster than arrays depending on how many elements they contain. If you can, go on to give specific examples of where a set would be a better idea than an array.
Estimated difficulty: Easy
Watch me answer this question in detail
See the full list of iOS interview questions
Codable
?
Float
, Double
, and CGFloat
data types?
Link copied to your pasteboard.