Waleed Khamies · Second edition

It isn’t you.It’s the advice.

How to Solve Algorithm Problems, second edition

You practise what counts least.What counts most, you cannot practise alone.

The argument · Part I

Most candidates train the thing that decides the least.

The book starts by pulling that scoresheet apart. Once you can see what actually counts, your preparation reorders itself.

Decides the most

Communication

It decides more interviews than anything else, and it is the one people prepare for least.

Six more, which the book does not rank

  • Problem-solving
  • Attention to detail
  • Complexity
  • Debugging
  • Code efficiency
  • Modular code

Decides the fewest

Algorithms and data structures

← what most people practise

It lifts your ceiling, but it is rarely what fails you.

Beginners optimize by rewriting. Experienced candidates optimize by locating.
Section 4 · The Method

From section 07 · Two pointers

Not the trick. The condition that makes it work.

Anyone can show you two pointers. This book shows you what the input has to look like first, and what your answer quietly becomes when it does not.

Used where its condition fails, a technique does not crash. It hands you a confident, reasonable, wrong answer.

Figure 7.1 · Two pointers

target = 17

16 is short of 17. Only the left can help.

1 / 4

A page from section 7

Every listing is tested before it is printed.

Not proofread. Run.

Listing 4.2 The optimized solution: one pass, one dictionary.✓ tested

def two_sum(nums, target):
    seen = {}
    for i, value in enumerate(nums):
        complement = target - value
        if complement in seen:
            return [seen[complement], i]
        seen[value] = i
    return []

Look inside

Four pages, straight out of the book.

1 / 4 · The contents

Inside

Five parts, nineteen sections

I

Orientation

3 sections
  • 01Why Effort Isn't Enough
  • 02Where You Are Right Now
  • 03How You're Actually Being Scored
II

The System

3 sections
  • 04The Method: Eight Steps to Any Problem
  • 05Speaking the Language: Complexity
  • 06FGCC: Building Your Own Baseline
III

The Techniques

6 sections
  • 07Scanning: Two Pointers and Sliding Window
  • 08Searching: Binary Search and Hashing
  • 09Traversal: BFS and DFS
  • 10Backtracking, Properly
  • 11Dynamic Programming
  • 12Choosing a Technique
IV

In Practice

5 sections
  • 13A Complete Interview, Start to Finish
  • 14The KSum Family
  • 15The Combinatorics Family
  • 16The Linked List Family
  • 17The Binary Tree Family
V

The Modern Interview

2 sections
  • 18Interviewing in the Age of AI
  • 19Beyond Algorithms

Second edition

A full rebuild, not a reprint.

The first edition printed a listing that quietly returned two of five answers on its own example, and a reader wrote in about the Kindle formatting. This one was rebuilt so neither can happen again.

  • 01

    Rewritten from the first page.

    38,000 words against 15,600. The method that was only implied is now written down.

  • 02

    A test suite that ships with the book.

    So you can run the listings yourself rather than trust them.

  • 03

    Every diagram is generated from code.

    So a figure cannot drift from what it describes.

  • 04

    Typeset, not exported.

    A 14pt baseline grid, with mathematics in a face built for the body type.

Who wrote this

Waleed Khamies

Waleed Khamies

Applied scientist, machine learning and optimization

I have been the candidate who knew the algorithm and still lost the room, and I have been the one assessing whether someone could think out loud under pressure. The first edition came out of working out what I was doing wrong.

Now
AI consultant, production ML systems
Before
NTWIST · MILA · UpTech · Brown University Robotics Lab
Study
MSc Machine Learning, AIMS. Google AI Scholarship
Papers
Workshop papers at ICML 2021 and NeurIPS 2019, 2018

Scope

What this book does not do.

Here is what it leaves out, so you can decide now rather than after you have paid.

  • Weighted graphs, heaps and union-find. Section 19 says how to recognise each and where to go next; it does not teach them.
  • System design, and behavioural rounds beyond an outline.
  • A language tutorial. The listings are Python, but the method is not about Python.
  • A problem bank. There are about sixty worked listings, not five hundred exercises.

Questions

The ones people actually ask.

  • It is a different book, not a corrected printing. Email contact@solvealgorithms.com. You should not pay twice for a book that had defects in it.

  • No. It assumes you can write code and have solved some problems. It is for people whose practice has stopped converting into offers.

  • That is the reader it was written for. Section 3 is where you check whether volume is really what is failing you.

  • The listings are Python because it reads closest to pseudocode. Nothing in the method depends on it.

  • All nineteen sections in the browser, with no card and no expiry. Paying adds the files to keep.

  • Not yet. Only the digital edition is on sale. If print matters to you, say so at contact@solvealgorithms.com. That is how the decision gets made.

  • Problems at solvealgorithms.com/practice that grade against the book’s own test cases. Part of the book, not a separate product.

The offer

Read it free.
Keep it for $19.

239
pages
19
sections in five parts
38
diagrams, drawn from code
122
tests every listing must pass

Read online

Free
  • All 19 sections in your browser
  • Worked tutorials and the figures as visuals
  • Always the current edition
Create a free account

No card, no trial, no expiry

The files

$19$29Half price at launch
  • PDF in colour, plus five more, one per part
  • EPUB for phones and e-readers
  • The tested code and the practice companion
  • Yours to keep, offline, no account needed
Create an account & buy

USD · card via Stripe · refundable for 14 days