The Coding Interview Is a Performance, Not a Test
Most engineers treat coding interviews like exams — sit down, read the problem, start typing. That's exactly how weak candidates fail. They dive into code immediately, produce a half-working solution, get stuck on edge cases, and run out of time fumbling through bugs while the interviewer watches in silence.
Elite candidates treat interviews like structured problem-solving performances. Every minute is deliberate. They communicate constantly, build rapport with the interviewer, and demonstrate how they think — not just what they code.
The 5-Step Framework
Every coding interview should follow this structure. Memorize it, internalize it, and never skip a step.
Step 1: Clarify the Problem (2-3 minutes)
Before writing a single line of code, interrogate the problem. This is where weak candidates immediately diverge from strong ones.
| Weak Candidate | Elite Candidate |
|---|---|
| Reads the problem once and starts coding | Asks 3-5 clarifying questions before touching the keyboard |
| Assumes input constraints | Explicitly confirms: input size, data types, edge cases, expected output format |
| Skips examples | Walks through the given example out loud, then invents a second one |
Questions you must ask:
- What's the expected input size? (Determines whether O(n²) is acceptable)
- Can the input be empty or null?
- Are there duplicates? Negative numbers? Sorted or unsorted?
- Should I optimize for time or space?
- Is the output a value, an index, a boolean, or a modified structure?
Step 2: Explore Approaches Before Coding (3-5 minutes)
This is the single most important step and the one most candidates skip entirely. Think out loud about multiple approaches before committing.
The structure:
- Brute force first. Name it explicitly: "The naive approach would be O(n²) — nested loops checking every pair." This shows you understand the problem baseline.
- Identify the bottleneck. "The inner loop is redundant if I can look up complements in O(1)."
- Propose the optimized approach. "Using a hash map, I can reduce this to O(n) time with O(n) space."
- State trade-offs. "We're trading space for time here, which is usually the right call unless memory is severely constrained."
- Get confirmation. "I'd like to proceed with the hash map approach — does that sound good?"
| Weak Candidate | Elite Candidate |
|---|---|
| Jumps straight to coding the first idea that comes to mind | Discusses 2-3 approaches with time/space complexity before writing code |
| Cannot articulate why their approach works | Explains the intuition: "This works because..." |
| Gets locked into a bad approach and wastes 15 minutes | Pivots early when they sense an approach isn't working |
Step 3: Write Clean Code (10-15 minutes)
Now code. But how you code matters enormously.
Elite coding habits:
- Use meaningful variable names.
complementnotc.leftPointernotl. Your code should read like prose. - Talk while you type. Narrate what each section does: "I'm initializing the hash map... now I'm iterating through the array... checking if the complement exists..."
- Write modular code. Extract helper functions for complex logic. This shows design sense.
- Handle edge cases inline. Add guard clauses at the top for empty arrays, single-element inputs, etc.
- Don't optimize prematurely. Get the correct solution first, then optimize if there's time.
Code structure template:
| Weak Candidate | Elite Candidate |
|---|---|
| Single-letter variable names everywhere | Self-documenting code that the interviewer can follow without explanation |
| Silent for 10 minutes while typing | Narrates their thought process continuously |
| Writes one monolithic function | Extracts helpers, uses clear structure |
| Forgets edge cases entirely | Handles edge cases with guard clauses upfront |
Step 4: Test Your Solution (3-5 minutes)
Never say "I think this works." Prove it works.
Testing protocol:
- Trace through the happy path. Walk through the given example line by line, tracking variable state manually. Write the values on the whiteboard or comment them in your code.
- Test edge cases:
- Empty input
- Single element
- All same elements
- Already sorted / reverse sorted
- Maximum and minimum values
- Negative numbers (if applicable)
- Test a case that could break your solution. Think adversarially — what input would expose a bug?
| Weak Candidate | Elite Candidate |
|---|---|
| "I think this is correct" | Traces through 2-3 test cases with actual values, catches own bug before the interviewer does |
| Only tests the given example | Tests edge cases and adversarial inputs |
| Panics when they find a bug | Calmly says "I see an off-by-one here" and fixes it |
Step 5: Analyze Complexity & Discuss Improvements (2-3 minutes)
Without being asked, state the time and space complexity of your solution. Then discuss what could be improved.
- Time complexity: Walk through the dominant operations. "The outer loop runs n times, and the hash lookup is O(1), so overall this is O(n)."
- Space complexity: Identify what extra memory you used. "The hash map stores at most n entries, so space is O(n)."
- Possible improvements: If there's a better approach you didn't have time for, mention it. "If the input were sorted, we could use two pointers for O(1) space."
The 10 Core Patterns You Must Know
Every coding interview problem maps to one or more of these patterns. Recognizing the pattern is half the battle.
| Pattern | When to Use | Key Signal in the Problem |
|---|---|---|
| Two Pointers | Sorted arrays, pair/triplet finding | "Find a pair that...", "sorted array" |
| Sliding Window | Subarray/substring problems | "Contiguous subarray", "substring of length k" |
| Hash Map | Counting, lookups, grouping | "Find duplicates", "two sum", "group by" |
| Binary Search | Sorted data, optimization | "Sorted", "minimum/maximum that satisfies" |
| BFS / DFS | Trees, graphs, grids | "Shortest path", "connected components", "traversal" |
| Dynamic Programming | Optimization with overlapping subproblems | "Minimum cost", "number of ways", "can you reach" |
| Backtracking | Combinatorics, permutations | "Generate all", "find all combinations" |
| Monotonic Stack | Next greater/smaller element | "Next greater element", "trapping rain water" |
| Union-Find | Connected components, grouping | "Are these connected?", "number of islands" |
| Greedy | Local optimal = global optimal | "Minimum number of", "interval scheduling" |
Time Management: The 45-Minute Breakdown
Most coding interviews are 45-60 minutes, but only 30-35 minutes are for problem solving (the rest is intros, questions, etc.). Here's how elite candidates spend those minutes:
2-3 min
3-5 min
10-15 min
3-5 min
2-3 min
Communication: The Hidden Scorecard
Most candidates don't realize that communication is scored independently from correctness at top companies. Here's what the rubric actually looks like:
| Signal | Weak | Strong |
|---|---|---|
| Problem Understanding | Misunderstands requirements, doesn't ask questions | Asks great clarifying questions, identifies ambiguity |
| Approach | Dives in without a plan | Considers multiple approaches, discusses trade-offs |
| Collaboration | Codes silently, gets defensive at hints | Thinks out loud, incorporates hints gracefully |
| Code Quality | Messy, hard to follow, single-letter names | Clean, well-structured, readable |
| Testing | Declares "done" without verification | Systematically tests, catches own bugs |
| Resilience | Panics at difficulty, gives up | Stays calm, adjusts approach, asks for guidance |
The 7 Deadly Mistakes
- Not clarifying the problem. You solve the wrong problem perfectly. Instant fail.
- Coding before thinking. You write 30 lines, realize the approach is wrong, and panic with 10 minutes left.
- Going silent. The interviewer can't evaluate what they can't observe. Silence = unknown = risk = no hire.
- Refusing hints. When the interviewer hints, they're helping you. Ignoring hints or getting defensive is a major red flag.
- Not testing. Declaring "I'm done" without tracing through examples signals overconfidence and carelessness.
- Over-engineering. Using a trie when a hash map works. Implementing a custom comparator when a simple sort suffices. Complexity without necessity is a negative signal.
- Giving up. Even a partial solution with clear reasoning scores better than a blank screen. Never give up.
Preparation Strategy That Actually Works
Quality Over Quantity
Solving 500 LeetCode problems randomly is how weak candidates prepare. They can't recognize patterns because they never studied them — they just memorized solutions.
Elite candidates solve 100-150 problems strategically:
- Organize by pattern, not difficulty. Do 10-15 problems for each core pattern.
- After solving, study 2-3 other solutions. Learn different approaches to the same problem.
- Re-solve problems you struggled with after 3-5 days without looking at your notes.
- Time yourself. Practice under realistic constraints (25-30 minutes per problem).
- Practice explaining out loud. Talk through your approach as if you're in the interview. Record yourself if possible.
The Week Before the Interview
- Do 1-2 medium problems per day — don't cram
- Review your notes on patterns, not individual solutions
- Do a mock interview with a friend or on a platform like Pramp
- Prepare your "tell me about yourself" answer (30-60 seconds)
- Get a good night's sleep — fatigue kills performance more than anything
During the Interview
- Use a language you're most fluent in — this is not the time to practice Rust
- If you're doing a virtual interview, use a clean IDE with a readable font size
- Have water nearby
- If you lose your train of thought, pause and say "Let me take a step back and re-think this"
- Always ask your interviewer questions at the end — it shows genuine interest