Most candidates know dozens of patterns. Far fewer have a reliable process for solving a brand-new problem under pressure.
Google’s 45-minute format rewards structured reasoning, collaboration, and adaptability over brute speed.
TL;DR: Treat every interview like a four-act play—Analyze, Design, Implement, Validate. Lead with clarifying questions, co-design the optimal approach, narrate readable code, and finish with rigorous validation plus thoughtful follow-ups.
This framework mirrors how top-tier interviewers think: clarity first, structured exploration second, refinement last. It shifts the focus from “coding fast” to co-reasoning transparently, which is exactly what Google’s rubric rewards.
Here’s the 45-minute meta-algorithm I teach mentees—a thinking script you can follow live in a Google-style interview.
👣 Overview
SolveGoogleStyleProblem(P):
0–5 min → Analyze & clarify
5–20 min → Design & collaborate
20–35 min → Implement clean solution
35–45 min → Validate, optimize, extend
| Phase | Time | Mindset | Key Actions | Example Prompts |
|---|---|---|---|---|
| Analyze | 0–5 min | Clarify & Align | Restate prompt, ask constraints, craft micro-example | “Are inputs sorted?” |
| Design | 5–20 min | Collaborate | Outline brute force → optimal, compare trade-offs, confirm direction | “Would a sliding window fit better here?” |
| Implement | 20–35 min | Code Cleanly | Narrate logic, keep structure readable, factor helpers | — |
| Validate | 35–45 min | Stress-Test & Extend | Edge cases, Big-O, follow-up adaptations | “How does this scale for streaming data?” |
Stage A — Analyze & Clarify (0–5 min)
- Read and restate the prompt to ensure shared understanding.
- Probe for constraints, edge cases, and hidden assumptions (“duplicates?”, “streaming input?”, “max N?”).
- Build a tiny example together; this becomes your baseline for later dry runs.
❓ Ask: What are we optimizing? Are inputs sorted? What are the size limits? How should invalid input be handled?
⚠️ Common pitfall: Jumping into coding before confirming input sizes or tricky edge conditions.
Stage D — Design & Collaborate (5–20 min)
Pattern recognition still shrinks the search space, but the emphasis shifts to co-designing the optimal path.
💬 Interviewer insight: Top scores often go to candidates who think aloud, invite feedback, and adjust gracefully when prompted.
| Clue | First Candidates |
|---|---|
| Contiguous subarray / substring | Sliding window, two pointers, prefix sums |
| Counting combinations or states | Dynamic programming |
| Searching for a value / threshold | Binary search (over value or index) |
| Relationships / connectivity | BFS, DFS, union-find |
| Parent-child structures | Tree recursion, stack |
| Maintaining min/max or kth | Heap, monotonic deque |
| Frequency or membership | Hash map / set |
Your checklist in this phase:
- State the brute force. Explain the naive solution to anchor the conversation.
- Map to patterns. Identify the fitting pattern family and justify the choice.
- Compare trade-offs. Discuss time, space, readability, and edge-case handling across approaches.
- Invite feedback. “I’m leaning toward a sliding window with a hashmap—does that align with what you’re expecting?”
- Draft pseudocode. Outline the core loops and conditions, then dry-run the earlier example to validate reasoning.
You: “Brute force would check every pair, so O(n²). If N hits 10^5 that breaks, so I’d pivot to a sliding window with a hashmap. Does that direction make sense for what you were expecting?”
Interviewer: “Yes, let’s see how you’d maintain the counts.”
⚠️ Common pitfall: Over-optimizing before confirming correctness or interviewer alignment.
Stage I — Implement (20–35 min)
- Translate pseudocode to clean, readable code with descriptive identifiers.
- Narrate intent as you type so the interviewer follows your logic.
- Extract helper functions for repeated or complex logic.
- Sprinkle focused comments where invariants or pointer movement get tricky.
⚠️ Common pitfall: Diving into silent coding sprints—silence hides intent and deprives you of mid-course corrections.
Stage V — Validate & Extend (35–45 min)
- Lead with Big-O time and space complexity, tying it back to constraints.
- Walk through tricky edge cases (empty input, maximum bounds, degenerate patterns).
- Offer extensions proactively—streaming data, generalized K constraints, or space optimizations.
- Reflect on what you would explore with more time (testing strategy, alternative data structures).
You: “We iterate once, so O(n) time, and the hashmap caps at K distinct chars, so O(K) space. For an empty string we return 0; for repeated chars the window shrinks correctly.”
Interviewer: “How would this change if the data arrived as a stream?”
You: “I’d maintain the same window but persist counts in a sliding buffer, or switch to a deque if eviction order matters.”
⚠️ Common pitfall: Waiting for the interviewer to ask about complexity or follow-ups—lead the discussion to show ownership.
🧠 The A–D–I–V Mantra
When you need a single mental hook, memorize:
Analyze → Design → Implement → Validate
Repeat it until it becomes instinct.
Example: “Longest Substring Without Repeating Characters”
- Analyze — Clarify duplicates, alphabet size, and walk through “abcabcbb”.
- Design — Brute force is ; optimal is sliding window with a hashmap to track counts.
- Implement — Maintain
left, iterateright, shrink while constraint breaks, updatemax_len. - Validate — Complexity is time, space (k = alphabet size); discuss adapting to streaming text or varying alphabet size.
Make Your Own Cheat Sheet
- Put the A–D–I–V mantra at the top.
- Include the classification table plus collaborative prompts for the Design phase.
- List clarifying questions you want to ask by default (input bounds, ordering, duplicates, streaming).
- Add a follow-up checklist: streaming inputs, K-generalization, space optimization, alternate data structures.
Want a printable version? Email me and I’ll share the PDF.
📄 Bonus: I’m packaging these notes into a one-page PDF cheat sheet. Drop a line if you’d like the download link as soon as it’s live.
Suggested Enhancements to the Flow
- Lead the conversation. After restating the problem, drive the clarification dialog to show partnership.
- Narrate assumptions. Verbalize complexity targets (“If N ≤ 10^5 we need O(N log N) or better”).
- Time-box branching ideas. Compare two designs for 1–2 minutes, then commit and explain why.
- Checkpoint mid-implementation. Pause after wiring the main loop to confirm alignment.
- Adopt a debugging ritual. Trace invariant variables, then run through corner cases aloud.
- Prime follow-ups early. Mention potential extensions during validation to guide the conversation.
- Debrief at the end. Share one takeaway or next step to demonstrate growth mindset.
Interviewer Scoring Alignment
| Interviewer Metric | Corresponding Phase | How to Signal Strength |
|---|---|---|
| Problem Understanding | Analyze | Restate, clarify constraints, surface edge cases early |
| Solution Quality | Design | Compare brute force vs. optimal, justify trade-offs, invite feedback |
| Code Quality | Implement | Write readable code, narrate abstractions, handle errors gracefully |
| Communication & Testing | Validate | Lead with complexity, probe edge cases, suggest follow-ups |
Four-Week Interview Prep Plan
To internalize the 45-minute flow, follow this 4-week schedule (1–2 hours/day). Track the problems you attempt, time per phase, and one learning per session. Once the cadence feels natural, rotate through the mind-map branches below so every pattern family gets deliberate reps.
Week 1 – Analyze & Clarify Foundations
- Goal: Sharpen pattern recognition and clarifying-question instincts.
- Daily:
- 15 min: Drill the classification table. Pick 5 random prompts and list the questions you’d ask.
- 45 min: Solve 2 easy array/string problems, practicing spoken clarifications.
- 15 min: Review which questions yielded crucial constraints.
- Milestone: Surface targeted clarifiers within 2 minutes of reading a prompt.
Week 2 – Collaborative Design Mastery
- Goal: Move from brute force to optimal while articulating trade-offs.
- Daily:
- 10 min: Outline brute force → optimal transitions for two prompts without coding.
- 50 min: Solve 2–3 medium problems (DP, graph, greedy) while narrating design decisions.
- 20 min: Review editorial solutions; note alternative approaches and when they win.
- Milestone: Present two approaches and justify the final pick within 15 minutes.
Week 3 – Implementation Clarity
- Goal: Code steadily with clear narration and minimal backtracking.
- Daily:
- 5 min: Recite the A–D–I–V mantra; skim your cheat sheet.
- 60 min: Mock session—1 medium + 1 hard problem. Time every phase.
- 20 min: Record your implementation commentary; replay to spot gaps.
- Milestone: Finish problems in 30–35 minutes with clean code and self-driven test cases.
Week 4 – Validation & Follow-up Agility
- Goal: Build stamina and confidence with extensions and optimizations.
- Daily:
- 10 min: Drill follow-up prompts (streaming inputs, space trade-offs, K-generalization).
- 45 min: Solve two hard problems back-to-back, emphasizing validation dialogue and extension brainstorming.
- 30 min: Weekly retrospective—identify recurring bottlenecks and adjust.
- Milestone: Handle a 45-minute mock (including follow-ups) smoothly, with time to spare for Q&A.
Ongoing Tips
- Rotate problem tags weekly to keep classification sharp.
- Track progress in Notion/Google Docs; note clarifying questions that paid off.
- Practice in interview-like conditions (single screen, timer, quiet room). Schedule rest days to prevent burnout.
- Measure success by solve rate (target 70–80% within 45 minutes) and communication clarity. Revisit the “Longest Substring” problem mid-plan—you should solve it in ~20 minutes with full narration by Week 4.
With deliberate practice, the flow becomes muscle memory. Pair it with behavioral prep (STAR stories) and system design drills to cover the full interview spectrum.
🏆 LeetCode Problem Classification: An Interview Road Map
This expanded guide distills each major pattern family into short, textbook-style chapters. Use it alongside the interactive mind map: classify the prompt, revisit the relevant section, and apply the “Analyze → Design → Implement → Validate” mantra.
📚 Arrays & Strings (Fundamental Patterns)
What It’s About
Arrays and Strings are contiguous sequences—every complex problem eventually touches them. Master indexing, boundary handling, and memory-aware iteration.
How to Tackle
- See the indices. Picture the array as numbered boxes.
- Decode keywords. “Subarray/substring” ⇒ sliding window; “sorted/palindrome” ⇒ two pointers.
- Guard the edges. Test empty, single-element, and boundary-crossing scenarios.
- Chase efficiency. Replace naive pair scans with windows, prefix sums, or sorts.
Core Subpatterns
- Sliding Window: Expand/contract
[start, end]to maintain constraints (no repeats, target sum). - Two Pointers: Move inward/outward on sorted or mirrored data.
- Prefix Sums: Precompute
PrefixSum[i]to answer range queries in . - Hash Maps/Sets: Track counts, membership, or complements in near-constant time.
- Monotonic Stack/Queue: Maintain ordered candidates for “next greater” or window extrema problems.
Practice: LeetCode #3 (Longest Substring Without Repeating Characters), #76 (Minimum Window Substring), #239 (Sliding Window Maximum).
Quick examples & hints
- Longest Repeating Character Replacement: Track counts in a hashmap and shrink when window - maxCount > k.
- Container With Most Water: Two-pointer sweep, always move the shorter wall.
🌲 Trees (Binary & General)
What It’s About
Trees encode hierarchy; binary trees limit nodes to two children, while BSTs impose ordering.
How to Tackle
- Recursive mindset. Write helpers that solve for one node, trusting children’s results.
- Traversal fluency. Preorder, inorder, postorder, and level-order are your templates.
- BST advantage. Drop half the search space at each comparison.
Core Subpatterns
- DFS/Recursion: Traverse structure, compute subtree values, rebuild trees.
- BFS (Level Order): Use queues for per-depth processing and shortest unweighted paths.
- BST Logic: Validate, search, insert, or find successors in logarithmic time.
- Lowest Common Ancestor: Find shared ancestry via recursion or parent tracking.
Practice: LeetCode #94 (Binary Tree Inorder Traversal), #102 (Binary Tree Level Order Traversal), #236 (Lowest Common Ancestor of a Binary Tree).
🔗 Linked Lists
What It’s About
Nodes plus pointers. Excellent for practicing pointer discipline.
How to Tackle
- Draw the list. Visual aids prevent pointer loss.
- Protect
next. Save references before rewiring links. - Handle head/tail edge cases with dummy (sentinel) nodes.
Core Subpatterns
- Fast & Slow Pointers: Detect cycles, split lists, find middles.
- Reversal: Iteratively flip links with
prev,curr,next. - Dummy Node: Simplify insert/delete logic at the head.
Practice: LeetCode #141 (Linked List Cycle), #206 (Reverse Linked List), #143 (Reorder List).
🔍 Search Algorithms & Divide & Conquer
What It’s About
Exploit order or self-similarity to cut work drastically.
How to Tackle
- Binary Search: Requires a monotonic predicate (“too small” vs. “big enough”).
- Divide & Conquer: Split problems into similar subproblems; combine results.
- Greedy vs. D&C: Greedy commits locally optimal moves—only trust it with proof.
Core Subpatterns
- Binary Search: Index-based or answer-based halving.
- Greedy: Interval scheduling, coin change variants, activity selection.
- Classic D&C: Mergesort, quickselect, recursive geometry.
Practice: LeetCode #33 (Search in Rotated Sorted Array), #50 (Pow(x, n)), #435 (Non-overlapping Intervals).
🔄 Backtracking & Recursion
What It’s About
Systematically explore decision trees; undo choices that fail constraints.
How to Tackle
- State definition: What parameters describe your position?
- Choice enumeration: Iterate through valid next moves.
- Backtrack: Restore state after each recursive call.
Core Subpatterns
- Permutations/Subsets: Generate orderings, combinations, power sets.
- DFS with Pruning: Cut off branches that cannot succeed.
- Bitmasking: Pack subset state into integers for constant-time operations.
Practice: LeetCode #46 (Permutations), #77 (Combinations), #90 (Subsets II).
📈 Dynamic Programming (DP)
What It’s About
Memoize overlapping subproblems with optimal substructure.
How to Tackle
- State & recurrence: Define
dp[i]ordp[i][j]and derive transitions. - Memoize or tabulate: Top-down recursion with caching or bottom-up tables.
- Optimize space: Collapse dimensions when only prior rows/cols matter.
Core Subpatterns
- 1D DP: LIS, House Robber, climb stairs.
- 2D DP: Edit distance, unique paths, DP on grids.
- Knapsack family: 0/1, unbounded, multi-dimensional.
- Space optimization: Rolling arrays, two-row DP.
Practice: LeetCode #300 (Longest Increasing Subsequence), #198 (House Robber), #62 (Unique Paths).
Quick examples & hints
- Coin Change: Bottom-up DP where
dp[i]is min coins for amounti. - Edit Distance: 2D table comparing prefixes; transitions consider insert, delete, replace.
🕸️ Graphs
What It’s About
Vertices and edges model relationships, connectivity, and flow.
How to Tackle
- Represent wisely: Adjacency lists for sparse graphs; matrices for dense.
- Track visits: Prevent infinite loops in cyclic graphs.
- Choose traversal: BFS for shortest unweighted paths, DFS for structural exploration.
Core Subpatterns
- DFS/BFS Traversal: Connected components, cycle checks, flood fill.
- Union-Find: Near-constant-time connectivity queries and Kruskal’s MST.
- Shortest Path: BFS, Dijkstra, Bellman-Ford, Floyd–Warshall.
- Topological Sort: Order DAGs with prerequisites (Kahn’s algorithm or DFS).
Practice: LeetCode #200 (Number of Islands), #207 (Course Schedule), #743 (Network Delay Time).
🗄️ Heaps & Specialized Queues
What It’s About
Priority structures that surface extrema quickly.
How to Tackle
- Match heap size/type to the problem (min-heap for top K largest, max-heap for top K smallest).
- Balance dual heaps to track medians in streaming data.
Core Subpatterns
- Top-K Elements: Maintain a heap of size
k. - Median of Stream: Two heaps, rebalanced after each insertion.
- Priority Queue Scheduling: Process jobs/events by priority.
Practice: LeetCode #215 (Kth Largest Element in an Array), #347 (Top K Frequent Elements), #295 (Find Median from Data Stream).
⏱️ Interval & Sweep Line
What It’s About
Manage overlapping ranges and time-based events.
How to Tackle
- Sort intervals: Usually by start time (or end time for greedy picks).
- Sweep line: Convert starts/ends into events, maintain active counts.
Core Subpatterns
- Merge Intervals: Combine overlapping ranges greedily.
- Difference Array / Sweep: Track concurrent intervals with +1/-1 events.
- Meeting Rooms: Pair sorting with heaps to count rooms in use.
Practice: LeetCode #56 (Merge Intervals), #253 (Meeting Rooms II), #759 (Employee Free Time).
🧠 Advanced Strings & Bitwise
What It’s About
Specialized pattern matching and low-level arithmetic.
How to Tackle
- Prefix structures: Tries, prefix tables (KMP) accelerate lookups.
- Bit tricks: Encode sets, flip bits, and isolate uniques with XOR.
Core Subpatterns
- Trie (Prefix Tree): Shared-prefix dictionary lookups.
- KMP / Rolling Hash: Linear-time pattern search.
- Bit Manipulation: Masks, shifts, XOR-based uniqueness detection.
Practice: LeetCode #208 (Implement Trie), #28 (Find the Index of the First Occurrence), #136 (Single Number).
🧩 System Design / Math Concepts
What It’s About
Randomness, probability, and number theory within coding rounds.
How to Tackle
- Reservoir Sampling: Uniformly sample from streams of unknown length.
- Fisher–Yates Shuffle: Create unbiased shuffles in linear time.
- Modular Arithmetic: Keep large-number math within constraints; work with GCD, modular inverses, and primes.
Core Subpatterns
- Sampling Algorithms
- Unbiased Shuffling
- Math Foundations: GCD, prime sieves, modular exponentiation.
Practice: LeetCode #382 (Linked List Random Node), #384 (Shuffle an Array), #1492 (The kth Factor of n).
🧭 Putting It All Together
| Phase | Topics | Focus & Goal |
|---|---|---|
| I: Foundation | Arrays & Strings, Linked Lists | Master basic data manipulation, indexing, and pointers. |
| II: Structure | Recursion, Trees, Graphs | Model hierarchy and connectivity; gain DFS/BFS fluency. |
| III: Optimization | Dynamic Programming, Heaps, Search/D&C | Move from brute force to optimal solutions. |
| IV: Specialization | Intervals, Advanced Strings, Bitwise | Apply high-leverage techniques to niche prompts. |
Interview Mindset: For every new prompt, pause and ask: Which pattern family does this most resemble? That single question bridges theory and on-the-spot execution.
Appendix – Behavioral Echoes & Quick Drills
Notice how A–D–I–V mirrors behavioral answers too: clarify → propose → execute → reflect. When you wrap up an interview, reference that same cadence (“I clarified the constraints, proposed two options, implemented the optimal one, and validated edge cases”) to subtly signal maturity.
I’m also experimenting with a lightweight “quick-drill generator” that will pair random pattern prompts with the stage you should emphasize (analyze vs. validate). If that sounds useful, let me know and I’ll prioritize wiring it into the interactive mind map.
Printable Mind Map
Instead of a static image, explore the classification interactively below. Tap any node to expand or collapse its children, and drag or zoom to inspect different regions.
Happy interviewing—and remember: Analyze, Design, Implement, Validate.