IK40ZZ01KY

3Sum

3Sum is one of the most popular questions in coding interviews. What’s more, it has several variations that seem to be more complicated, but in essence are same as the basic form.

We haven’t covered many topics about numbers in the past. Since 3sum questions have been asked by Google and Facebook recently, it’s a great time for us to analyze this topic in detail now.
(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

OLYMPUS DIGITAL CAMERA

Meeting Room Scheduling Problem

In our previous posts, we’ve covered topics like string, tree, linked list and so forth. In this week’s coding interview question, we’re going to discuss something different.

If you have taken many coding interviews, you will know that a lot of questions are quite close to real life projects and don’t have a focus on specific data structures. Some people find it hard at first glance. However, with some analysis, you’ll realize that there are no different from other questions.
(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

IU6HNPC2NT

Lowest Common Ancestor

Tree problems are so popular recently that we’ve seen so many candidates have been asked about it by companies like Google, Facebook, Microsoft and so on.

On second thought, this makes a lot of sense. Tree is one of the most useful and fundamental data structures in real products. For instance, tree structure is widely used in machine learning like decision trees. What’s more, tree related interview questions can cover a lot of topics like iteration and recursion.

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

FSPLFPQBCZ

Build a Web Crawler

Let’s talk about this popular system design interview question – How to build a web crawler?

Web crawlers are one of the most common used systems nowadays. The most popular example is that Google is using crawlers to collect information from all websites. Besides search engine, news websites need crawlers to aggregate data sources. It seems that whenever you want to aggregate a large amount of information, you may consider using crawlers.
(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

o_19sj4n0p610v61a5skru1i7t1q0r7_new

Design a Key-Value Store (Part II)

This is the second post of Design a Key-Value Store series posts. If you haven’t read the first post, please go check it.

In our previous post, we mostly focus on the basic concepts of key-value store, especially the single machine scenario. When it comes to scaling issues, we need to distribute all the data into multiple machines by some rules and a coordinator machine can direct clients to the machine with requested resource.

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

compass-691006_640

Design a Key-Value Store (Part I)

Since many people have emailed us saying they want to read more about system design interviews, we’re going to cover more on this topic. I’m quite happy to hear a lot of feedbacks and if you have any suggestions or questions, do tell us by leaving a comment.

This week, I’m going to talk about key-value store. A key-value store is a very power technique that is used in almost every system in the world. It can be as simple as a hash table and at the same time, it can also be a distributed storage system. For instance, the underline system of Cassandra is a key-value storage system and Cassandra is widely used in many companies like Apple, Facebook etc..
(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

trekking-299000_640

Flatten a Linked List

Linked list is one of the most common data structures that are usually covered in coding interviews. Like I mentioned in our previous post, since data structures like binary tree, linked list have limited ways of operation, the problem usually can’t be too hard in an interview. The biggest thing is to really spend your time being familiar with them.

In this post, I would focus on topics including linked list manipulation, queue, BFS and summarize some common techniques as before.

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

dice-free-license-cc0-980x649

Random ID Generator

Let’s continue our system design interview questions discussion. If you are new to this series, you can check our previous posts. Basically, each week we are going to pick several interesting interview questions and provide in-depth analysis.

It’s worth to note that the post is not about giving you something like a standard answer. Instead, we focus more on analyzing the problem and how to come up with reasonable approaches. This is even more true for system design interviews because the question can be extremely open-ended.

This week, we will talk about how to a random ID generator. We will cover a bunch of topics including scaling the ID generator and pros and cons of each approach.

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

tumblr_nnmrdskJiY1qfirfao1_1280

Second Largest Element of a Binary Search Tree

Over the past several weeks, many of our users suggested us cover some questions about BST (Binary search tree) as they’ve been asked about this recently.

BST is a very good data structure to ask in coding interviews. Here are the reasons:

  • BST is a widely used data structure and it’s important to know it.
  • It’s neither too complicated nor too simple to ask in a coding interview.
  • Many concepts like traversing, recursion can be covered with BST related questions.

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More

OLYMPUS DIGITAL CAMERA

Subarray With Given Sum

This week, we’re going to talk about a popular question that seems simple at first glance, but can be quite difficult by removing particular restrictions. This type of question is very common in coding interviews as interviewers like to use the easy version as a warm-up question and if there’s still time remained, the follow-up question will be asked.

Also, in our previous posts, we didn’t cover much about array problems. So it’s definitely worth to analyze this problem in depth. In this article, we will talk about topics including array, sliding window, recursion and DP (dynamic programming).

(more…)

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Reddit

Read More