Skip to content

Coding interviewsbroken down

We'll walk you through the patterns behind interview questions one step at a time. That way a problem you've never seen still looks familiar.

It's free to get started.

Shortest Length Subarray Sum, slide 1 of 13: a and b start at 0. window_sum is 0 and shortest is None.
1 / 13

You can also use the ← and → arrow keys.

These are the real slides from the Shortest Length Subarray Sum lesson.

How long do you have?

We make you a study plan that fits the time you have before your interview.

What you'll learn each week

Week 1Two PointersSliding WindowIntervals
Week 2Linked List ManipulationModified Binary Search
Week 3Tree Breadth First SearchGraph Breadth First Search
Week 4Graph Depth First SearchBacktrackingDynamic Programming

You can learn all 10 patterns.

That's 25 problems. We give you fewer problems per pattern so you can learn more patterns.

Make my plan

You can also read our one-week, one-month and three-month study plans.

We've both been the interviewer and the candidate more times than we can count. We kept seeing people who could code well but didn't know how to start on a new problem. We built InterviewCrunch to teach that first step.

Anita & Andrew

Adding to a list

O(n) or O(1)

Here are two common methods to add elements to a list:

  • append() adds the element to the end of the list
  • insert() takes in a second argument that specifies what position to add the element at

Note

insert() is an O(n) complexity operation whereas append() is an O(1) operation. Use insert() sparingly. Use a queue if you only need to add to the front.

secret = ["I", "love", "lists"]
secret.append("!!")
secret.insert(1, "really")
print(secret)
main.py

Learn the data structures first

Almost every interview problem is built on a list, a dictionary, or a set. Our lessons start there. They explain each one in plain words and give you examples you can run, like the one on this page.

  • The free lessons explain every structure and how fast each of its operations runs.
  • The advanced lessons add heaps, deques, trees, and graphs.
  • You also get two free cheat sheets to review it all later.
Two Pointers slide, step 1 of 11
1 / 11

You can also use the ← and → arrow keys.

Watch each algorithm run one step at a time

Each of the ten patterns we teach comes with visual slides that walk through the algorithm step by step. All the solutions for a pattern start from the same template. That means you can use what you learn on one problem on the next one.

Valid Palindrome

Easy

A phrase is a palindrome if it reads the same forward and backward after ignoring punctuation, capitalization, and spaces. Write a function that returns true if the given string is one.

"Han ah!" → True"Hugo" → False
def is_palindrome(s):
    left = 0
    right = len(s) - 1
    while left < right:
        if s[left] != s[right]:
            return False
        left += 1
        right -= 1
    return True

print(is_palindrome("step on no pets"))
main.py

Practice questions that feel like the real interview

Every pattern comes with practice problems like the ones interviewers ask. You write your code right in the browser and run it against test cases to see if it works.

First you need to know which pattern to use

Lots of people get stuck on a problem they could have solved because they don't know where to start. You can practice that first step with this quiz. You read a problem and pick which pattern you'd use. We explain why the right pattern fits after you answer. The Daily 8 gives you eight new questions every day.

Try one right now.

Reverse String

Easy

You need to reverse a list of characters in place, without building a second list. Which pattern fits?

Cheat sheets you can earn

Every pattern has a one-page cheat sheet you can keep for review.

  • You unlock a pattern's sheet by solving 2 or 3 of its problems.
  • Full access members get the complete PDF booklet after they earn all ten sheets.
  • You can download the fundamentals sheets for free without an account.

Got an interview coming up?

Hundreds of engineers have prepped with InterviewCrunch. It's free to get started.