What is ContiguousArray and why use it?
The gist
ContiguousArray<Element> is an array that always stores its elements in one contiguous block of memory. Its API matches Array (it is also a RandomAccessCollection, RangeReplaceableCollection, a value type with CoW).
The difference is the storage. On Apple platforms Array can be bridged to NSArray: if the array came from Objective-C (NSArray as [Model]), a Cocoa buffer sits underneath, and every index access goes through a "native or bridged buffer" check and an objectAtIndex: call. ContiguousArray doesn't bridge to NSArray, so that check doesn't exist.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep