You are given a list of candidate words words, where each word has length 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
Implement findSecretWord(words, master) to identify secret by calling master.guess at most allowedGuesses times.
Note: Each call to
master.guessmust use a word fromwords, andsecretis guaranteed to be inwords.
Constraints:
words.length
words[i].length
words[i] consists of lowercase English letters
All strings in words are unique
secret exists in words
allowedGuesses
You are given a list of candidate words words, where each word has length 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
Implement findSecretWord(words, master) to identify secret by calling master.guess at most allowedGuesses times.
Note: Each call to
master.guessmust use a word fromwords, andsecretis guaranteed to be inwords.
Constraints:
words.length
words[i].length
words[i] consists of lowercase English letters
All strings in words are unique
secret exists in words
allowedGuesses