Copy-on-write: what is a1.count after append?
Task
var a1 = [1, 2, 3, 4, 5]
var a2 = a1
a2.append(6)
let x = a1.count
What is x? When did the copy happen and what did it cost?
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep