The Building Blocks Approach. Guide to Problem Levels: Easy, Medium, Hard

What are Building Blocks?

Problems in this course are divided into Building Blocks. You might have seen these before, but identifying them separately makes you focus on those and master them. This makes it easier to reuse them in the interview. This also makes it easier to apply them to a problem you haven't seen before.

For example, take Binary Search, a fundamental building block. Once you know it at the tip of your fingers, you can make small modifications to solve related problems. You can also use it in more complex problems. We will show you how.

Another building block is the Linked Hash Table. You can use it to solve the LRU Cache Problem, but once you know it, you can also use the same technique to solve problems like Finding the Skyline. If you don't know those right now, its fine. You will learn them later.

How to solve each problem in this course

Regardless of a problem's level, you should understand each problem deeply. Even if you get an easy problem, simply coding it will not be enough. You should be able to discuss it and solve similar problems.

What does deeply mean?

Deeply means that you not only understand how an algorithm works, you can teach it as well. You need to be comfortable with it. Here is how you accomplish that:

1. Practice on Paper: Practicing on paper makes a huge difference. Try it out. Write a solution 3 times on paper, and you'll see the difference. If you have a whiteboard, that works too. Later on, you can code it on a computer if you like.

2. Practice each technique 3-5 times: You can carry a notebook anywhere with you. Repeat a solution you implemented a few days ago. Don't memorize it, just implement it. You will start seeing patterns and develop muscle memory for these algorithms.

So, even for Easy problems, practice the code at least 3 times.

Why 3 times? The first time is a struggle. The second time, you are getting comfortable with it. By the third time, it becomes second nature to you.

But how many Problems should I practice deeply?

There's 2 approaches:

1. Practice each Building Block's solution deeply.

2. Practice each Building Block's solution deeply AND each Homework Problem deeply.

Do approach 2 if you have the time. Otherwise, approach 1 is good enough. This will give you a solid foundation of each Block.

Question Levels - Easy, Medium, Hard

You should assume the following distribution of questions in your interviews:

20% Easy
60% Medium
20% Hard

This is typical of companies like Google and Facebook. Even if you're interviewing elsewhere, I would recommend you anticipate this distribution. Why? Because it has a good balance of all levels.

Easy

If you don't know how to do an easy question, start from there, and practice them.

If you have seen a question in the past, use it to practice explaining the solution. Solve it again, and in your head, explain it to the interviewer.

Medium

These are questions that you should focus on the most. Medium level questions are most likely to come up in most interviews. People over focus on Hard problems. In reality, if they were really good at Medium problems, they'd be getting most job offers anyway, because these are the most asked.

Hard

There is a tendency online to focus on problems that are way too hard. For example, String search using the Boyer-Moore Algorithm. Or some really complicated graph algorithm. Those might come in programming competitions, not coding interviews.

Unfortunately, it makes people believe that you need to learn these ridiculously hard problems to get into Google. Not so.

Hard problems in this course are problems that actually show up in interviews. If you are comfortable with all our Hard and Medium problems (which means you can solve them easily) you are probably ready for the interview.

Two ways to go over this course (Both these approaches are fine, follow your comfort level)

1. Do video solutions first for the week, then go back and do homework problems for the week.

2. Do video solutions and immediately do homework problems for that video.

A Note on Dynamic Programming (DP)

DP is the most feared topic. We think it gets disproportionate amount of attention.

Consider this:

First of all, DP is a dying class of problems in interviews. Google and Facebook actively discourage DP-only problems. These are problems that can only be solved well using DP.

We estimated that around 3% questions in top tech companies will need dynamic programming. That is 1 interview in 30.

In reality, it is ok if in one interview, your solution is suboptimal. As long as you do well in other interviews, it wouldn't matter.

Unfortunately, I hear people make statements like this:

"I am great at all topics, but I screw up complicated DP problems, and that is holding me back"

If you were really good at all topics except DP, you would be getting offers left and right. In most cases, there are more basic problems with the candidate. Either they stumble when they see a new problem, or something is wrong in their interview approach and communication.

Here is how I would approach it: Go through our DP section and learn to do common DP problems. This will give you a good idea about how it works. Focus on completing other sections first, and then start doing more complicated DP problems.

For more details, look at out "DP Myths" Section.

Complete and Continue