Free · No account · Six languages
Coding interview courseEarly access
8 modules, taken in order. Each one opens with the pattern and a template short enough to write from memory, explains why the obvious approach is too slow, then gives you problems to solve in an editor in this page. When you want the pressure, the exam runs here too — timed, with limited submissions and a report at the end.
Start the course Sit the exam →
- 8
- modules
- 40
- lessons and problems
- 6
- languages
seen = {} # key -> whatever you need back
for i, x in enumerate(a):
key = derive(x) # the whole problem is choosing this
if key in seen:
use(seen[key], i) # look up BEFORE inserting, or you match x with itself
seen[key] = iunordered_map<long long, int> seen; // key -> whatever you need back
for (int i = 0; i < (int)a.size(); i++) {
long long key = derive(a[i]); // the whole problem is choosing this
auto it = seen.find(key);
if (it != seen.end()) use(it->second, i); // look up before inserting
seen[key] = i;
}Map<Long, Integer> seen = new HashMap<>(); // key -> whatever you need back
for (int i = 0; i < a.length; i++) {
long key = derive(a[i]); // the whole problem is choosing this
Integer prev = seen.get(key);
if (prev != null) use(prev, i); // look up before inserting
seen.put(key, i);
}const seen = new Map(); // key -> whatever you need back
for (let i = 0; i < a.length; i++) {
const key = derive(a[i]); // the whole problem is choosing this
if (seen.has(key)) use(seen.get(key), i); // look up before inserting
seen.set(key, i);
}let mut seen: HashMap<i64, usize> = HashMap::new(); // key -> what you need back
for (i, &x) in a.iter().enumerate() {
let key = derive(x); // the whole problem is choosing this
if let Some(&prev) = seen.get(&key) { use_it(prev, i); } // look up before inserting
seen.insert(key, i);
}import qualified Data.Map.Strict as M
-- fold the array, carrying the map and the answer together
solve :: [Int] -> Int
solve = snd . foldl step (M.empty, 0) . zip [0 ..]
where
step (seen, acc) (i, x) =
let key = derive x -- the whole problem is choosing this
acc' = case M.lookup key seen of -- look up before inserting
Just prev -> use prev i acc
Nothing -> acc
in (M.insert key i seen, acc')
The syllabus
Everything below is open. The order matters more than people expect: each module assumes the argument made in the one before it, and the exam draws on all of them.
-
01112 min
Arrays and hashing
Trade memory for time: a hash map answers "have I seen this?" in O(1), and most array problems reduce to asking it the right question.
- Lesson The pattern and its template 5 min
- Lesson Understanding the problem 7 min
- Problem Pair with a given sum in an unsorted array Easy 10 min
- Problem Longest run of consecutive integers Medium 15 min
- Problem The k most frequent values Medium 15 min
- Problem Count subarrays with a given sum Medium 20 min
- Problem Product of every element except itself Medium 15 min
- Problem Smallest positive integer that is missing Hard 25 min
-
0256 min
Two pointers
Two indices walking a sorted or paired structure, each step ruling out one candidate for good.
-
0342 min
Sliding window
A window that grows on the right, shrinks on the left, and holds an invariant at all times.
-
0447 min
Binary search
Search the answer, not the array: halve a monotone predicate until one candidate is left.
-
0548 min
Dynamic programming
Write the recursion, notice the repeats, fill a table in an order that makes each entry final.
-
0662 min
Stack
Keep the elements whose question is still open; each new element settles the ones it beats and waits its turn.
-
0768 min
Heap (priority queue)
Keep the few elements that matter in a structure that hands you the smallest (or largest) in O(1) and updates in O(log n).
-
0870 min
Backtracking
Build a solution one choice at a time, and abandon a branch the moment it cannot succeed.
How it works
When it applies, the signals in the question that point to it, and a template you should be able to write without thinking. Most interview bugs are deviations from the template made without a reason.
An editor with the signature ready, your code compiled and run against the real test table, and hints you open only if you need them. Solutions in all six languages, every one tested before publication.
Exam mode gives you a window sized to the difficulty, a limited number of runs and submissions, and a report showing where the marks went. Solving alone and solving while the clock runs are different skills.
Exam mode
Pick a set and it starts here, in this page. Nothing is saved to an account and nothing is sent anywhere — the report is yours.
Choose a set
The rules
- Easy problems get 12 minutes, medium 20, hard 30.
- 8 runs and 3 submissions per problem.
- A failed submission costs 15 marks; opening a hint costs 10.
- Opening the solution scores the problem zero, as it would in a real screen.
Write a solution and run it against the real test table.
Common questions
Is the course really free?
Yes. Every lesson, every problem, every solution and the timed exam are open, with no account and no card. Nothing is held back behind a sign-up.
Which languages are covered?
Python, C++, Java, JavaScript, Rust and Haskell. Every solution is given in all six, and each one is compiled and run against the problem’s test table before it is published — so what you read is what passed.
Do I need to know a pattern before I start?
No. Each module opens with when the pattern applies and a template short enough to write from memory, then a lesson on why the obvious approach is too slow, and only then the problems.
What is exam mode?
A timed screen with the constraints of a real one: a window sized to each problem, a limited number of runs and submissions, a penalty for a failed submission, and a report at the end showing where the marks went. It runs in this page.
Is this for quant interviews or software interviews?
Both. The patterns are the same ones tested at trading firms and at large technology companies. The difference at a quant desk is the follow-up questions about complexity and numerical care, which the solutions address as they go.
How long does it take?
About 8 hours of reading and solving if you work through it in order, which is the way it is meant to be used. Most people come back to the exam several times.
Want someone watching how you code?
The gap between solving a problem alone and solving it while someone interrupts you is the whole interview. I run mock interviews one to one, and I have sat on both sides of them.