After a long time, I’m finally back and I hope I’ll be able to post LeetCode solutions much often.
Yes I mentioned before that C++ is the best programming language for solving DSA problems, but that particular problem, I think would be solved in Python much easier (corresponding code there would be much less).
This is an interactive problem.
You are given an array of unique strings
6 letters long, and one word in this list is chosen as
You may call
Master.guess(word) to guess a word. The guessed word should have type
string and must be from the original list with
6 lowercase letters.
This function returns an
integer type, representing the number of exact matches (value and position) of your guess to the
secret word. Also, if your guess is not in the given wordlist, it will return
For each test case, you have exactly
10 guesses to guess the word. At the end of any number of calls, if you have made
10 or fewer calls to
Master.guess and at least one of these guesses was
secret, then you pass the test case.