FastPrepWord Guess Feedback Colors
Problems/Word Guess Feedback Colors

Word Guess Feedback Colors

Atlassian logoAtlassian● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives five-letter G/Y/X feedback and the first three examples. The practice interface keeps the secret as the first argument. Repeated-letter allocation follows the exact-match-first rule stated here.

Compare a five-letter guess with a five-letter secret, and return five feedback characters in guess order. The first argument is the secret; the second is the guess.

  • G (green): the letter is correct at this position.
  • Y (yellow): the letter exists in another unmatched position of the secret.
  • X (gray): no unmatched copy remains in the secret.

For this exercise, assume exact matches are assigned first. Then process the other guess positions from left to right, using each remaining secret letter at most once. This defines feedback when letters repeat.

Complete wordGuessFeedback(secret, guess). The function name is the practice interface; the feedback rules and argument order above also apply to a function named generateFeedback.

Follow-up: Keep this feedback function reusable by a solver that filters possible secrets after each guess and always chooses the first remaining word.

Function

wordGuessFeedback(secret: String, guess: String) → String

Examples

Example 1

secret = "house"guess = "stole"return = "YXYXG"

The guess letters are s, t, o, l, e. The s and o occur elsewhere in house, t and l are absent, and e matches position 5. The feedback is YXYXG.

Example 2

secret = "crane"guess = "plane"return = "XXGGG"

The p and l in the guess are absent from crane. The a, n and e match positions 3, 4 and 5, giving XXGGG.

Example 3

secret = "crane"guess = "mould"return = "XXXXX"

None of m, o, u, l or d occurs in crane, so every position is X.

Example 4

secret = "apple"guess = "allee"return = "GYXXG"

The first a and last e are exact matches. One remaining l gives Y at position 2. No second l or unmatched e remains, so positions 3 and 4 are X.

Constraints

  • secret.length == 5 and guess.length == 5.
  • Both strings contain only lowercase English letters.

More Atlassian interview questions

  • Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Deterministic Word Guess SolverONSITE INTERVIEW · Seen Oct 2026
  • Generate Word Guess FeedbackONSITE INTERVIEW · Seen Oct 2026
  • Bounded Word Guess SolverONSITE INTERVIEW · Seen Oct 2026
  • Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Longest Consistent Activity StreakPHONE SCREEN · Seen Sep 2026
  • Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
  • Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
  • Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026

Similar questions at other companies

  • Feature Flags with Rules, Dependencies and ExposurePerplexity AI · ONSITE INTERVIEWPerplexity AI interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Invoice / Payment ReconciliationStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • In-Memory Vault File SystemHarvey · ONSITE INTERVIEWHarvey interview questions
  • Stable Unique Column RenamesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Most Frequent Call Path in Interleaved LogsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Dictionary Records to an Editable XML TreeSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Choose the Next Hidden-Word GuessFlexport · ONSITE INTERVIEWFlexport interview questions
  • In-Memory Directory and File OperationsSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public String wordGuessFeedback(String secret, String guess) {
        // Write your code here.
    }

}
Checking account…