Compute worst-case guesses for adaptive hangman
Adaptive Hangman: Worst-Case Guesses
You are given a set of distinct lowercase words, all of the same length. A hidden word is chosen from this set, but the host is adversarial. After each of your letter guesses, the host may switch to any other word in the set, provided it remains consistent with every answer revealed so far.
On each turn, you guess one lowercase letter that you have not guessed before. The host then reveals the pattern for that letter with respect to some currently valid hidden word. This means: every matching position is shown, or the host may report that the letter does not appear if there exists a consistent word without that letter.
Your goal is to guarantee identification of the hidden word in the worst case. Return the minimum number of letter guesses needed if you choose guesses optimally and the host responds adversarially.
You may assume the word is identified once only one candidate word remains consistent with all revealed patterns.
AI interview prep
Core dilemma
Finding an optimal strategy to guarantee identification against an adversarial opponent who actively tries to prolong the game by choosing the worst possible response at each step, effectively a minimax problem in a game tree.
3 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Compute worst-case guesses for adaptive hangman
Adaptive Hangman: Worst-Case Guesses
You are given a set of distinct lowercase words, all of the same length. A hidden word is chosen from this set, but the host is adversarial. After each of your letter guesses, the host may switch to any other word in the set, provided it remains consistent with every answer revealed so far.
On each turn, you guess one lowercase letter that you have not guessed before. The host then reveals the pattern for that letter with respect to some currently valid hidden word. This means: every matching position is shown, or the host may report that the letter does not appear if there exists a consistent word without that letter.
Your goal is to guarantee identification of the hidden word in the worst case. Return the minimum number of letter guesses needed if you choose guesses optimally and the host responds adversarially.
You may assume the word is identified once only one candidate word remains consistent with all revealed patterns.