Wordle Feedback
Reported by candidates from Retool's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The fastest way to burn a first attempt at Retool's Wordle Feedback question is to overbuild it. Real Wordle has duplicate-letter rules that trip everyone up, and candidates reported this one in June 2024 expecting them. Here they don't apply. Both strings have distinct uppercase letters, so it's a clean lookup problem. You compare each guess position against the answer and emit G, Y, or an underscore. If you blank on the live OA, StealthCoder runs invisibly on your desktop and hands you the working solution. But this one is short enough to own before you sit down.
The problem
The uppercase answer and guess have equal length and contain no repeated letters within either word. Return one character per guess position: G when the letter and position match, Y when the letter occurs elsewhere in the answer, and _ when the letter is absent. Function wordleFeedback(answer: String, guess: String) → String Examples Example 1 answer = "ABCD" guess = "ACDE" return = "GYY_" A is green, C and D are present elsewhere, and E is absent. Example 2 answer = "PHONE" guess = "HOWLS" return = "YY___" H and O are in the answer but at different positions. Example 3 answer = "PHONE" guess = "WALKS" return = "_____" No guessed letter occurs in the answer. Constraints 1 <= answer.length == guess.length <= 26. Both strings contain distinct uppercase English letters.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The pattern is a hash-table lookup, or just a set of answer letters. Walk the guess by index. If guess[i] equals answer[i], write G. Else if guess[i] is in the answer set, write Y. Otherwise write an underscore. That's O(n) time. The common pitfall is importing the full Wordle duplicate-counting logic, with two passes and letter budgets. The constraints say no repeats in either word, so none of that is needed, and it just adds bugs. The second pitfall is checking Y before G, which marks exact matches wrong. Check G first. Also watch the output: build a string of the same length as guess, and use the underscore character exactly as shown in the examples. If you freeze during the live OA, StealthCoder is the safety net that reads the prompt and gives you this logic on screen while the proctor sees nothing.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Wordle Feedback cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Retool's OA.
Retool reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Wordle Feedback FAQ
How hard is the Retool Wordle Feedback problem really?+
Easy. It's a single pass over the guess with a set lookup. The difficulty is psychological, because people remember real Wordle and assume duplicate-letter handling is required. The constraints rule that out, so read them first and keep the solution small.
What's the trick to Wordle Feedback?+
Put the answer's letters in a set, then check each guess position in order: exact index match gives G, membership in the set gives Y, anything else gives an underscore. Check G before Y. That's the whole solution, and it runs in linear time.
Do I need to handle duplicate letters?+
No. The problem states both the answer and the guess contain distinct uppercase letters, with no repeats within either word. A two-pass counting approach would work but is unnecessary. Keep it simple, and mention the assumption in a comment if the platform allows it.
What edge cases should I test?+
Test a length-1 word that matches, a length-1 word that doesn't, a fully correct guess, and a guess with no shared letters like the PHONE and WALKS example. Also confirm your output uses the underscore character and has the same length as the guess.
How do I prepare for this in 48 hours?+
Write this one from memory twice, then do a few easy hash-set and string-building problems to warm up. Practice reading constraints before coding, since they decide whether you need the complicated version. Skip deep dives into advanced topics for this question.