← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Google coding interview with a classic interactive search problem. The whole thing hinged on knowing how to prune a candidate set intelligently under a tight guess budget, which sounds manageable until you're actually in the room trying to articulate a minimax strategy on the fly.

Questions Asked (1)

Q1

You have a list of candidate 6-letter words and an API that returns the number of exact character-position matches between your guess and a hidden secret word. Find the secret word in at most 10 guesses. How do you approach this?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

My first instinct was to just guess randomly and prune, which is technically fine but completely misses the point.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints and API behavior, then propose a strategy that partitions the candidate list based on feedback. Use an information-theoretic approach to minimize worst-case guesses, and discuss trade-offs between greedy heuristics and optimal decision trees.

Pro tip: Mention that you can precompute the feedback for all pairs of candidate words to build a decision tree offline, which is a common technique in Mastermind-like games and demonstrates strong algorithmic thinking.

1. Clarify constraints and API

Ask about the size of the candidate list, whether the secret is guaranteed to be in the list, and if the API returns only the count of exact matches or also partial matches. Confirm that guesses must be from the candidate list.

2. Model as a search problem

Represent each candidate word as a possible secret. Each guess partitions the remaining candidates into groups based on the feedback (number of exact matches). The goal is to reduce the candidate set to one within 10 guesses.

3. Choose a guessing strategy

Consider a greedy approach: at each step, pick the guess that minimizes the size of the largest resulting partition (minimax). Alternatively, use an information-theoretic measure like entropy to maximize expected information gain.

4. Analyze worst-case performance

Calculate the maximum number of guesses needed with the chosen strategy. For 6-letter words, the feedback ranges from 0 to 6, giving 7 possible outcomes. With 10 guesses, we can distinguish up to 7^10 possibilities, which is huge, so 10 is likely sufficient.

5. Discuss optimizations and trade-offs

Mention precomputing the feedback matrix for all pairs of words to speed up the decision tree construction. Discuss the trade-off between optimal worst-case (minimax) and average-case (entropy) strategies, and note that precomputation may be feasible if the candidate list is small.

Key Points to Mention

  • Information theory: each guess provides at most log2(7) bits of information, so 10 guesses provide ample information to identify the word.
  • Minimax strategy: choose the guess that minimizes the maximum remaining candidates.
  • Entropy-based strategy: choose the guess that maximizes expected information gain.
  • Precomputation: build a decision tree offline by simulating all possible feedbacks for all pairs of words.
  • Worst-case analysis: show that 10 guesses is sufficient by bounding the number of candidates or using a decision tree depth argument.
  • Trade-offs: time vs. space for precomputation, and optimality vs. simplicity of implementation.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.