JavaScript Coding Interview: Prefix Sums and Binary Search

Bartosz Zaczyński 19 Lessons 2h 48m Updated intermediate career

Coding interviews test how you think through a problem: how you clarify it, pick an approach, write the code, and explain what it costs. That skill matters even more now that AI writes a lot of code, because someone still has to judge whether the code is correct and fast enough. That someone is you.

In this course, you’ll practice two patterns that trade a little preparation for much faster answers:

  • Prefix sums, to store running totals once so that the total of any stretch takes a single subtraction, and to find stretches with a given total by pairing prefix sums with a Map
  • Binary search, to cut a sorted array, or a range of possible answers, in half at every step until only the answer is left

Every problem is set in a realistic web-app scenario and runs in your browser on Node 26. Your first goal is a working solution. Then a bonus test plays the interviewer’s follow-up and checks whether your solution still holds up at scale.

Along the way, you’ll review AI-written code that compares floating-point money with ===, test your pattern spotting in a quiz, and finish with a mock interview scored on communication, problem solving, code quality, and testing.

What’s Included:

  • 19 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 10 Hands-On Coding Exercises
  • Q&A With JavaScript Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

About Bartosz Zaczyński

Bartosz is an experienced software engineer and programming educator with an M.Sc. in Applied Computer Science.

» More about Bartosz

Each tutorial at RealJS is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses