A while back, Apple reached out to me about a position on the SwiftUI Mac frameworks team. Having worked with SwiftUI since its release, I was really excited about this opportunity. But after years as an indie developer, this was my first real technical interview in a while.

Spoiler alert: I didn’t get the job. But I did learn something about Swift algorithm design and how to approach technical interviews.

The Assignment

For the interview assignment, I was asked to implement a function called coalescingAdjacentDuplicates() as if it were being added to the Swift Standard Library, with emphasis on generality, performance, and safety.

The solution had to support being used like this:

let x = [1, 2, 2, 3, 3, 3, 1]
for element in x.coalescingAdjacentDuplicates() {
prin...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help