Daily iOS
CS fundamentals and algorithmsReddit

Anchored two-way lookup

Chat messages sit in an array sorted by id ascending. When the user taps a push notification to jump to a specific message, how would you write a function that returns that id plus up to 5 messages on each side, at most 11 in total, in ascending order?

Submit