Lesson 5 of 6 · 20 min · 1 hands-on step
Mock Interview: Solve It Like You're on the Call
A realistic phone-screen problem with the full talk-track, then your turn.
Hear what a strong answer sounds like
Here's how a strong candidate talks through this problem. Read it out loud once, then do the practice step the same way.
Clarify: "So for each index I multiply every other element? Can there be zeros or negatives? Can I use extra space for the output?"
Example: "For
[1, 2, 3, 4], index 0 is 2·3·4 = 24, index 1 is 1·3·4 = 12…"Brute force: "For each index, multiply all the others. That's two nested loops, O(n²)."
Insight: "Each answer is everything to the left times everything to the right. I can compute running products from both directions in two passes."
Complexity: "O(n) time, O(1) extra space apart from the output."
Test: "With a zero, like
[2, 0, 5]: left products are[1, 2, 0], right products[0, 5, 1], giving[0, 10, 0]. ✓"
See the two passes
const nums = [1, 2, 3, 4];
const left = [], right = [];
let acc = 1;
for (const n of nums) { left.push(acc); acc *= n; }
acc = 1;
for (let i = nums.length - 1; i >= 0; i--) { right[i] = acc; acc *= nums[i]; }
console.log("left: ", left);
console.log("right:", right);
console.log("answer:", left.map((l, i) => l * right[i]));Make mock interviews a habit
- On your own: record yourself solving an Interview Prep question out loud, then watch it back. You'll spot every silent stretch
- With a friend: take turns as interviewer, using Interview Prep questions
- Record yourself solving a problem out loud. Awkward, but you'll instantly hear where you go quiet
After every mock, write down one thing to improve. Ten deliberate mocks will change how you perform on the real call.
🧪 Practice
Interviewer: "Given an array of numbers, return a new array where each position holds the product of all the other numbers. Do it in O(n) and without using division."
productExceptSelf([1, 2, 3, 4]) → [24, 12, 8, 6]
Set a 30-minute timer. Talk through the brute force first, then the optimized idea, then code it.
function productExceptSelf(nums) {
}
Output appears here. Press Run or Ctrl/⌘ + Enter.
✅ Check your understanding
You're stuck for 2 minutes in a live interview. What should you do?
Create a free account to track your progress.