Wordle Guess Loop
Updated
Problem statement
Every supplied uppercase word has the same length and contains no repeated letters. Start with start and repeatedly make Wordle guesses until you reach answer.
After each wrong guess, compute G, Y, and _ feedback against the answer. Choose the lexicographically smallest unvisited dictionary word that would produce exactly that feedback if it were the answer. Remove each chosen word from future consideration.
Return the number of guesses including the starting guess, or -1 if no unvisited consistent word remains.
Function
countWordleGuesses(words: String[], start: String, answer: String) → intExamples
Example 1
words = ["ABCD","ACBE","AEBC"]start = "ABCD"answer = "AEBC"return = 3Feedback GYY_ first selects ACBE, then the next feedback selects AEBC.
Example 2
words = ["PHONE","HPABC","APBHC"]start = "PHONE"answer = "APBHC"return = 2APBHC is the smallest unvisited word matching the observed feedback.
Example 3
words = ["START"]start = "START"answer = "START"return = 1The starting word is already the answer.
Constraints
1 <= words.length <= 2000.1 <= words[i].length == start.length == answer.length <= 26.- Every word contains distinct uppercase English letters.
answeroccurs inwords.
More Retool interview questions
- Maximum Profit with Exactly One Stock TransactionPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Order Sources by Their DependenciesPHONE SCREEN · Seen Oct 2026
- Execute In-Memory SQL QueriesPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
- Maximum Profit with Exactly Two Stock TransactionsPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
- Next Consistent Wordle GuessPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2024
- Wordle FeedbackPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2024
- Markov Transition Counts and ProbabilitiesONSITE INTERVIEW · Seen Mar 2026
Similar questions at other companies
- Credit Card Command ProcessorChime · PHONE SCREEN
- Aggregate Paginated Project Run RecordsReplit · OA
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
- Determine the Winner of Three-Card HandsOpenAI · PHONE SCREENOpenAI interview questions
- Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions
- Group AnagramsWorkday · PHONE SCREEN
- Deterministic Secret Santa AssignmentShopify · PHONE SCREENShopify interview questions
- Shortest-Job-First Process SchedulingByteDance · PHONE SCREENByteDance interview questions
- Load/Store Arithmetic InterpreterJane Street · PHONE SCREENJane Street interview questions