Be prepared

EPI Judge Beta

The EPI Judge is now available at GitHub!

The installation is super-simple - there’s no install! You just download the project, point your IDE/editor to it, and start the code-debug cycle, with instant feedback!

EPI Judge consists of the following:

  • Stub programs for each problem in our book in Python, Java, and C++
  • Test-cases that cover common corner-case and performance bugs
  • A framework for running these tests on your implementation on your machine

The best interview preparation is a combination of hands-on practice over a representative set of problems with quality explanations.

The best way to get this hands-on practice is by developing, running, and debugging programs in the environment you’re most comfortable with, i.e., your own computer and IDE/editor:

  1. It’s a very fast compile-debug cycle,
  2. you have complete control and visibility, both into the internal state and the test data,
  3. you can use the features such as autocomplete, autoformat, linting, definiton lookups, etc., and
  4. you can choose to use version control, to track your own progress, as well as to pull updates.

This screenshot should give you a good idea of what it’s about.

A big shout-out to Viacheslav Kroilov, for applying his exceptional software engineering skills to make EPI Judge a reality.

Read More

Buying EPI

Please follow these instructions to make sure you get the most recent copy of EPI.

This is very important because you want the latest version of EPI, which is the one for which the seller is Amazon, which may not be the default seller on Amazon’s website.

First, do not click on add-to-cart from the landing page (since the default seller is not always Amazon). Instead click on the text highlighed in the figure below.

Next, find Amazon in the list of sellers, as in the example below. (Note how Amazon is not at the top of the list!)

Now add EPI to your cart, and you are good to checkout!

Read More

The Onsite

Many people find interviews intimidating. One reason is the intrinsically challenging problems. However, the challenge goes beyond that - the offices and the work environment are often quite different from anything you’ve seen.

As part of our goal to help readers succeed at interviews, we’ve compiled some pictures of what a typical campus looks like. The intention is to set you more at ease so that you can focus on the technical content.

These pictures are from Facebook (right by Adnan’s office), but are fairly representative.

Come early, so you don’t have to struggle with finding the building, parking, etc. It’s fine to wait in the lobby for an hour, decompress with a copy of EPI!

The lobby - this is where the recruiter will come to pick you up.

The interview room. It’s a fixed room for the duration of the interview, though you may step out for lunch with a host. The interviewers/host/recruiter are supposed to ensure you stay on schedule, but there’s no harm in being proactive, e.g., not letting lunch run late.

Here the entire wall is writable, but it’s more common to have a whiteboard. Pro tip: consider taking your own markers, so that you can be sure they write well.

Dining hall - free yummy food, but don’t overeat and get into a food coma, or lose focus.

Nice campus, but it’s more important to focus on the interview. Do well and there will be plenty of time to appreciate these later.

Microkitchens are common.

Random office equipment.

Bike storage.

Read More

EPI in Python

EPI in Python was the single biggest ask from our readers, and we’re very happy to tell you that EPI in now available in Python! You can buy it directly from Amazon here.

We’ve been using Python as our daily language at Facebook and Uber for quite some time now, and have grown to appreciate its power, versatility, and aesthetics. We wrote Python code for EPI Python from the ground up, and invested a great deal of effort to find the most efficient ways to solve interview problems in Python.

We hope you enjoy reading this book as much we we enjoyed writing it. As always, we look forward to hearing our readers thoughts and criticisms of our work. Feel free to drop us a line, come by in person if you are in the Bay Area. (Ice Cream at the Facebook Sweet Shop is always fun.)

Read More

EPI variants and versions

This post clarifies questions we are often asked about EPI versions and variants.


There are two basic printed variants: Elements of Programming Interviews (which is in C++), and Elements of Programming Interviews in Java.

Each comes in two sizes: 6” x 9” and 7” x 10” - the latter uses a larger font and greater line spacing. The smaller and larger formats contain exactly the same content.

Amazon does a poor job of showing the variants. Here’s direct links to them:


People are often confused the publication dates, e.g., October 2012 date listed for the original 6 in x 9 in EPI (C++).

EPI has changed enormously since the initial release - the first release came at commit 1200, we are now at commit 3900. On the way we’ve added and removed problems, features, and content, based on trends we’ve seen at interviews. We regularly upload updated PDF to Amazon’s on-demand publishing arm, and it goes live immediately.

For this reason we very strongly recommend that you buy only from Amazon itself, not from resellers on Amazon. Regardless of the advertised release date, the version sold by Amazon itself is always current - resellers may be selling old stock, or even worse, pirated copies which have very poor print quality.

Read More

Dear readers - we need your help to select a new cover!

To celebrate all the changes we have made to EPI since its first release, we are creating a new cover.

We held a design competition, and we would like you to help us pick from the finalists. Click here to vote on covers. (Direct link to poll:

Here is a screenshot of the poll.

Read More

Please help us review some exciting new features!

New features

EPI is a community book - its content, quality, and very existence, are a testament to the engagement and enthusiasm of its readers.

In this spirit, we are asking readers to help us by providing feedback on some new material we’ve been working on. Specifically, based on your feedback, we are adding the following features to EPI:

  • Expanded introductions for each chapter. These introductions include
    • An example that illustrates the key data structures and algorithms for that chapter, e.g., how to use binary search with a custom comparator.
    • A table of top-tips for the chapter, e.g., consider reversing arrays of digits to operate on the least-significant digit first.
    • A review of the most important library methods, e.g., Arrays.asList(1,3,5).
  • More domain specific questions. Specifically, in addition to the existing chapter on system design problems, we are adding the following chapters.
    • Programming language questions, e.g., the difference between final and finally.
      a Object-oriented principles, e.g., explain the difference between a class adapter and an object adapter.
    • Tool questions, e.g., describe the role of merging in a version control system.

By acting as a reviewer, you will get

  • a chance to perfect your interviewing skills,
  • an early look at the book,
  • our undying gratitude, and,
  • a free hardcopy of the book, if you are one of the first 25 reviewers or make great contributions to this review.

If you are interested, please sign up via this Google form.

We expect reviewers to spend one to two afternoons going through the assigned material, and identify an issue every 1 to 2 pages.

The perfect is the enemy of the good - please send us your inputs as soon as you can. (We are hoping to have a substantial amount of feedback by mid April.

Issues can be typos, language that is misleading, suboptimum solutions, bad programming practices - in short anything that can improve the quality of the book. Every individual issue you identify should be reported through a Google form, which you can view here.

Here are some examples of issues reported by readers. Note how specific these suggestions are - they have details on where the issue was, what the problem was, what the right wording should be, etc.

  • Suggestion: Solution 12.14: I feel that the limitations of the template method particularly in C++ should be addressed.
  • Typo: The account of HTTPS consistently spells certificate as sertificate.
  • Suggestion: Drop Variant 10.16.1, as it is effectively the same as Problem 10.18.
  • Clarification: I don’t see how it’s possible to sort in O(n) time, as suggested by the writeup at the start of Chapter 13.
Read More

Introducing the EPI online judge

July 7, 2016

We’re closing the judge service for the near future as we take the lessons learned and build out a more robust and full-featured service.

Jan 14, 2016

We’ve put together a prototype online judge service that you can use to practice for interviews.

Take a look at the screenshot at the end to see the UI, or just click on the link.
No login is needed, just read the problem description and start hacking!

The judge problems correspond to the problems in the PDF sample. These problems are an ideal starting point for anyone who wants to get up to speed with interviewing. (Right now, all programs are in Java.)


We use directed tests for the judge problems, and try to give meaningful feedback. For example, if your program for testing if a binary tree is balanced fails, you will see a report like the following.

Incorrect result on balanced tree {0,1,2,3,#,4,5}

If your program fails to compile, we return the compiler error, and the line numbers will correspond to the lines in your program.

Line 7: error: incompatible types
int y = "asd";
required: int
found: String
1 error

If your program throws an exception, we return the stacktrace - the line numbers will not correspond to the lines in your program.

Exception in thread "main" java.lang.RuntimeException
at BalancedBinaryTree.isBalanced(
at BalancedBinaryTree.main(

Your program runs in Docker container, so don’t worry about crashing or damaging our server. We run the program with a timeout of 20 seconds, so if your program has an infinite loop, or is very slow, you’ll get a timeout response. If the server is under load, it may block requests that are too frequent.

A few programs require you to have an efficient solution to pass, e.g., if you brute-force compute the parity, you will see the judge informs you that your solution is too slow:

Execution Timed Out


We’re very excited about offering this service, and look forward to developing it - adding more problems, adding a login and persisting your code, classification of problens, drag-and-drop into the editor, executing from Github, etc.

Reader Input

As always, we treasure user input. Please share your thoughts with us about the judge. Some things we’re especially keen on learning about are:

  1. Bugs, e.g., program never returns, hint button doesn’t work, etc.
  2. Source of confusion, e.g., misleading stack traces, wording of error
  3. General UI issues: is editor font ok? do you prefer a light background?
  4. How important are features like login, timing, etc.?

Read More

Elements of Programming Interviews in Java

The Java version of EPI is in press ready!

It should be available from Amazon in a few days.
We will post a direct link to the Amazon page when it is ready.

It’s here!

Link to Amazon page
for EPI in Java.

The only difference between the original EPI and EPI in Java is that
the programs are now in Java instead of C++. (We also have a short chapter
on Java, which includes best coding practices for an interview and a small
number of language review questions; this replaces the similar chapter on C++
in the original EPI.)

All programs, Java and C++, are always available from the website.

We will continue to sell the original EPI for readers who prefer C++.

Read More

EPI back at Amazon

EPI is not currently available from Amazon, we are working on this issue

As of 12:43 CDT 9/15/2015, EPI is available again!
Read More