Tap here to switch tabs
Problem
Submissions

Problem: Guess the Word

med
30 min
Try to solve the Guess the Word problem.

Statement

You are given a list of candidate words words, where each word has length 66 and all words are distinct. One of these words is the hidden word secret.

You can interact with an external API master.guess(word), which takes a string word and returns an integer equal to the number of positions where word and secret have the same character. If word is not present in words, the API returns −1-1.

Implement findSecretWord(words, master) to identify secret by calling master.guess at most allowedGuesses times.

Note: Each call to master.guess must use a word from words, and secret is guaranteed to be in words.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • words[i].length =6= 6

  • words[i] consists of lowercase English letters

  • All strings in words are unique

  • secret exists in words

  • 10≤10 \leq allowedGuesses ≤30\leq 30

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Guess the Word

med
30 min
Try to solve the Guess the Word problem.

Statement

You are given a list of candidate words words, where each word has length 66 and all words are distinct. One of these words is the hidden word secret.

You can interact with an external API master.guess(word), which takes a string word and returns an integer equal to the number of positions where word and secret have the same character. If word is not present in words, the API returns −1-1.

Implement findSecretWord(words, master) to identify secret by calling master.guess at most allowedGuesses times.

Note: Each call to master.guess must use a word from words, and secret is guaranteed to be in words.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • words[i].length =6= 6

  • words[i] consists of lowercase English letters

  • All strings in words are unique

  • secret exists in words

  • 10≤10 \leq allowedGuesses ≤30\leq 30