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)
No more replies