๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Interview DSA Crash Course Module 1 ยท Lesson 3 of 15

0% Exit to course

Module 1 ยท Complexity and how to think out loud Lesson 3 of 15

Explaining before writing

Learning objective

Say the plan in plain language, get agreement, then code. Silent typing is the most common reason a technically correct candidate is rejected.

The concept

The interview is a conversation about code, not a typing test. Say the plan before the code: "I will keep two pointers, one at each end, and move the one with the smaller value until they meet โ€” that is O(n) time and O(1) extra space." Then write it, and they can follow every line.

Work an example on the shared screen or on paper first, step by step, and let them correct you there rather than at line twenty. If you get stuck, say what you are stuck on โ€” a candidate who says "I think the window contract breaks when the character repeats" is easier to help than one who stares silently.

Plain text
"I will keep two pointers, one at each end.
 Move the smaller one inward until they meet.
 That is O(n) time and O(1) extra space."

Say it, THEN write it. Work the smallest example by hand first.
Stuck? Say what you are stuck on - silence reads as panic.

Common mistakes

The mistake is silence. Silence reads as panic to an interviewer even when you are thinking clearly, and it removes the guidance they are allowed to give you. Narrate the choices โ€” "I am using a set here because I need to know whether I have seen the character" โ€” and the code becomes the easy part.

Worked example

"I will use a hash map from value to index, so for each item I check whether target minus it is already in the map โ€” that is O(n) time and O(n) space. Shall I write that?" is a full, close to winning answer.

Your practice task

Solve one problem out loud to a friend or a recorder, narrating every step, before writing a single line.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

The interview is a conversation about code, not a typing test.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.