NewThe Learning module is now liveSee what's new
avatar
zhoukevinOct 25, 2026

Snap phone screen, top K from a stream

Interview Experiences
snap

Snap phone screen, top K from a stream

Just finished the phone screen, one coding problem. Design a class that takes a stream of values with add and get top K. Talked through a heap approach and got the first part working without much trouble.

Follow up was what changes when the stream gets really big and queries are frequent. Had a couple ideas, like sharding the stream and merging per-shard heaps on query, but ran out of time to actually code any of it. Interviewer didn't give much away either way, so tbh no idea how it landed.

23373.7k

Replies (5)

avatar
tylerwuOct 25, 2026

hope it works out

105
avatar
zhoukevinOct 25, 2026

thanks!

8
avatar
david.parkOct 25, 2026

ran out of time on the follow up too, felt like they wanted more than a heap

94
avatar
User-6lmq0Oct 25, 2026

snap phone screens feel hand written, nothing like the usual LC stuff

87
avatar
sophialinOct 25, 2026

which version did you get, plain top K or one with deletes?

58
avatar
zhoukevinOct 25, 2026

just add and top K query, the follow up was about scale

99
avatar
User-yvpscOct 25, 2026

how long did they take to get back to you?

16
No more replies