Recover a Hidden Word with Position Queries

Asked at Google · Coding Questions · Difficulty: Easy · Last asked Dec 15, 2025

A hidden word of fixed length is made of lowercase letters. You cannot see it; you can only ask an oracle `query(pos, letter) -> bool`, which returns `True` exactly when the hidden word has `letter` at the 0-indexed position `pos`. Recover the word without exceeding the call bound given in the rules.

Loading the problem…