FastPrepWordle Feedback

Wordle Feedback

Retool logoRetool● EasyFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW
Learn

Problem statement

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.

More Retool problems

See Retool hiring insights
public String wordleFeedback(String answer, String guess) {
    // write your code here
}
answer"ABCD"
guess"ACDE"
expected"GYY_"
Checking account…