Hello Interview (@_hellointerview) header
Hello Interview (@_hellointerview) profile picture

Where top software engineers prepare for interviews

Joined May 2023
Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)
Adding one server to your cache cluster can reshuffle most of its keys. Consistent hashing avoids that. Here's how.
1
17
1,021
Consistent hashing puts servers and keys on a ring. A key belongs to the first server clockwise from its position. Adding a server takes over only the interval before that server; keys elsewhere keep their owners.
1
123
Virtual nodes place each physical server at many points on the ring. This helps distribute data more evenly and spreads a failed server's ranges across several surviving machines. The full visual walkthrough: hellointerview.com/twitter/c…
69
A binary tree is nodes with at most two children. Root at the top, leaves at the bottom, height is the longest path between them. That is the whole vocabulary.
1
25
1,156
Almost every tree question is then the same move: ask what each node needs from its children, and let recursion carry it up.
1
1
379
Counting unique visitors with a set costs memory proportional to the visitors. HyperLogLog answers the same question in kilobytes, and gets it slightly wrong on purpose.
1
1
47
2,851
Count-Min Sketch handles frequency the same way. All three swap exactness for space, which is only a good deal when you know the error you are buying.
1
4
336
Every design with a photo, video or document in it eventually needs blob storage, and the mistake is treating it as a database that happens to hold files.
1
36
2,293
So the metadata lives in your database and the bytes live in S3, and the interesting question is how the two stay in step when one write succeeds and the other does not.
1
4
588