FastPrepNext Consistent Wordle Guess
Problems/Next Consistent Wordle Guess

Next Consistent Wordle Guess

Retool logoRetool● MediumFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Multiple firsthand Retool reports describe a Wordle follow-up. It gets an earlier guess, feedback with G, Y, and underscore, and a dictionary. Then it picks another word that keeps the green positions, moves the yellow letters, and skips guesses already made. Our version is about 94% the same as the reported question.

All supplied uppercase words have equal length and distinct letters. Given a previous guess and its G, Y, and _ feedback, return the lexicographically smallest different dictionary word that could be the answer.

A candidate is consistent when comparing it as the answer against previousGuess produces exactly the supplied feedback. Return the empty string if no different candidate is consistent.

Function

nextWordleGuess(previousGuess: String, feedback: String, words: String[]) → String

Examples

Example 1

previousGuess = "ABCD"feedback = "GYY_"words = ["ACBE","AEBC","AXYZ","ABCD"]return = "ACBE"

ACBE and AEBC are consistent; ACBE is lexicographically smaller.

Example 2

previousGuess = "PHONE"feedback = "YY___"words = ["HPABC","APBHC","PHONE"]return = "APBHC"

Both nonvisited words relocate P and H; APBHC sorts first.

Example 3

previousGuess = "ABC"feedback = "GGG"words = ["ABC","ABD"]return = ""

The only consistent word is the excluded prior guess.

Constraints

  • 1 <= words.length <= 100000.
  • 1 <= previousGuess.length == feedback.length <= 26.
  • All words and the previous guess contain distinct uppercase letters and have the feedback length.
  • Feedback contains only G, Y, and _.

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
  • Wordle FeedbackPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2024
  • Wordle Guess LoopPHONE SCREEN · Seen Jun 2024
  • Markov Transition Counts and ProbabilitiesONSITE INTERVIEW · Seen Mar 2026

Similar questions at other companies

  • Shortest Uncommon SubstringAirbnb · ONSITE INTERVIEWAirbnb interview questions
  • Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
  • Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
  • Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
  • Group AnagramsWorkday · PHONE SCREEN
  • Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
  • Digit-Coded Card ValidationCapital One · ONSITE INTERVIEWCapital One interview questions
  • Elevator Scheduling SimulationOpenAI · PHONE SCREENOpenAI interview questions
All Retool interview questionsSee Retool hiring insights
Saved
class Solution {
    public String nextWordleGuess(String previousGuess, String feedback, String[] words) {
        // write your code here
    }
}
Checking account…