The Coding Interview: Think Out Loud
Aims
Solve a coding problem the way interviewers want to see it: ask questions first, explain your plan, write the code while you talk, then test it and improve it
The lesson, stage by stage
- Warm up5 min
Warm-up: Today's Goal: Pass a Coding Round Out Loud
3 warm-up questions
- I am your interviewer. Tell me about a project you worked on recently. You have one minute.
- Have you had a coding interview in English before? How did it go?
- When you solve a problem at work, do you talk about it or think in silence?
- Practice7 min
Practice: Problem 1: Count the Words
Short-answer exercise, 1 item
- Write a function that takes a sentence and returns how many times each word appears. Use any language you like. Talk while you type.
- Reading10 min
Reading: Your Score: What the Interviewer Was Marking
Read a 291-word text about Your Score: What the Interviewer Was Marking
What the Interviewer Was Marking Most candidates think a coding interview has one question: can you solve it? Interviewers say something different. They usually mark four things. Problem solving. Do you break the problem into parts? Do you ask clarifying questions? Do you compare two ways to solve it and name the trade-off? Coding fluency. Is your code easy to read? Did you choose a sensible data structure? Did you think about each edge case, such as an empty input? Communication. Can the interviewer follow your thinking? Do you listen when they give you a hint? Working with others. Would they enjoy solving a real problem with you on a Tuesday afternoon? The common failure Dana is a strong engineer. In her interview she read the problem, said "OK", and typed in silence for twelve minutes. Her code was almost right. She did not get the job. The interviewer wrote: "I could not see how she thinks." Tomás had the same problem. He asked two questions first. He described a simple brute-force solution and said why it was slow. He wrote it, then chose one small input and did a walk-through line by line. He found his own bug. Then he said, "The time complexity is poor. Can I try to refine it?" He ran out of time before he finished the better version. He got the job. What this means for you You do not need the perfect answer on your first try. Write what comes first, say what is wrong with it, and improve it. You have about 45 minutes. Talk for all of them. Score your first problem Give yourself 1 to 4 for each of the four things. Your tutor will do the same. Compare the numbers.
- Vocabulary8 min
Vocabulary: Words for Thinking Out Loud
7 items
- Framework6 min
Framework: Five Steps for Any Coding Question
Clarify, Plan, Code, Test, Refine, 5 steps
Clarify, Plan, Code, Test, Refine: Five steps for any coding question. Say the name of each step aloud so the interviewer always knows where you are.
- Practice7 min
Practice: Problem 2: The First Repeated Number
Short-answer exercise, 1 item
- Write a function that takes a list of numbers and returns the first number that appears a second time. Use any language you like. Start with the simple solution, then refine it.
- Dialogue10 min
Dialogue: The Follow-Up Questions
Role-play: You have just finished your solution for the first repeated number. The interviewer has ten minutes left and asks follow-up questions. (10 lines)
- Interviewer: Thanks, that works. Can you walk me through it with a small example?
- Candidate: Sure. Let me walk through it with the list 3, 5, 5. First the set is empty. I see 3 and add it. I see 5 and add it. Then I see 5 again, it is already in the set, so I return 5.
- Interviewer: Good. What's the time complexity?
- Candidate: It's linear time, because I look at each number once. Checking the set is constant time.
- Interviewer: And is there a cost to that?
- Candidate: Yes, there is a trade-off. I use extra memory for the set. In the worst case it holds every number in the list.
- Interviewer: What happens if I pass an empty list?
- Candidate: Good question. The loop never runs, so the function returns null. I could also add a test for that edge case.
- Interviewer: Last one. If you had another twenty minutes, what would you change?
- Candidate: I would add tests for the edge cases, and I would give the function a clearer name. If the list were very large, I would also think about memory.
- Discussion10 min
Discussion: Second Take and Your Questions
4 discussion questions
- Second take: I am your interviewer again. Write a function that reverses a string. Take me through all five steps in two minutes. Compare with your first try.
- The interview is almost over. Ask me two questions about the team, the projects or the tech stack.
- Which of the five steps do you usually skip? What will you do differently next time?
- Many companies ask you not to use AI tools in the interview. What does that tell you about what they want to see?
Target vocabulary
In a Tuton account these words become your student's vocabulary deck, so they come back in practice between lessons.
- clarifying question
- A question you ask to be sure you understand the task
- edge case
- An unusual input that can break your code, such as an empty list or a very large number
- brute force
- The simple solution that tries every possibility. It works but it is often slow.
- trade-off
- A choice where you get one good thing and give up another
- time complexity
- How the running time grows when the input gets bigger
- walk through
- To follow your code one line at a time with a real example
- refine
- To improve something that already works
This plan comes from the Technical Interview English course in the Tuton library. Browse all free lesson plans.