In this course, you’ll practice two patterns that pay for a little work up front with much faster answers later: prefix sums and binary search.
What You’ll Practice
- Prefix sums: compute running totals in one pass, so the total of any stretch becomes a single subtraction, and pair them with a
Mapto find stretches that add up to an exact amount - Binary search: use the order of sorted data to throw away half of what’s left at every step, whether you’re looking for a value, a boundary, or the smallest answer that still works
You’ll also run into JavaScript details that interviewers like to probe:
- Why
0.1 + 0.2 === 0.3isfalse, and what that means for money - Why
reduce()without a starting value throws on an empty array - Why
(low + high) / 2can hand you an index of2.5 - Why
indexOf()is slower than it looks on a long sorted array
How the Course Works
- Concept lessons introduce each pattern with short examples you can run.
- Exercises run in your browser on Node 26, so you don’t need to install anything. Each problem is set in a web-app scenario. Get a working solution first. Then a bonus test plays the interviewer’s follow-up: does your solution still hold up when the input gets large?
- An AI-code review hands you a plausible budget checker with hidden bugs. Your job is to find them and fix them, which is the skill you need whenever an assistant writes code for you.
- Recaps at the end of each section let Mentor AI look at your attempts and talk through whatever hasn’t clicked yet.
- Mixed Practice ends the course with problems that don’t name their pattern, a quiz on choosing the right one, and a mock interview.
Before You Start
You should be comfortable writing JavaScript functions and working with arrays, objects, and loops. The exercises use Map from time to time, and Mixed Practice combines prefix sums with a Map lookup. If that feels rusty, the first course in this path, JavaScript Coding Interview: Hashing, Pointers, and Windows, covers it. Knowing what O(n), O(log n), and O(n²) mean helps, and the concept lessons review the costs you’ll need.
Your Cheat Sheets
Two cheat sheets go with every course in this learning path. Keep them open while you practice. The patterns sheet shows how to spot each interview pattern, with a JavaScript template for it, and the complexity sheet lists what common JavaScript operations cost in time and space.