FastPrepChoose Five Words with 25 Distinct Letters
Problems/Choose Five Words with 25 Distinct Letters

Choose Five Words with 25 Distinct Letters

Google logoGoogle● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks you to pick five different five-letter strings whose 25 letters are all different, using backtracking. We fixed the output to lexicographic order so it is always the same. Our version is about 95% the same as the reported question.

You are given distinct lowercase five-letter strings. Choose exactly five different strings so their combined 25 characters are all distinct.

Return the lexicographically smallest sorted array of five words among all valid choices. Return an empty array when no choice exists.

A word containing a repeated character can never be chosen.

Function

chooseFiveDisjointWords(words: String[]) → String[]

Examples

Example 1

words = ["abcde","fghij","klmno","pqrst","uvwxy","zzzzz"]return = ["abcde","fghij","klmno","pqrst","uvwxy"]

The first five words use 25 different letters.

Example 2

words = ["abcde","afghi","jklmn","opqrs","tuvwx"]return = []

The only five words repeat a, so no choice works.

Example 3

words = []return = []

Fewer than five words cannot form a choice.

Constraints

  • 0 <= words.length <= 200.
  • Every word has length five, contains lowercase English letters, and words are distinct.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Maximum Unique-Character Word SubsetMeta · ONSITE INTERVIEWMeta interview questions
  • Generate All Valid Word AbbreviationsSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Optimal Account BalancingAmazon · ONSITE INTERVIEW
  • All Balanced Strings from Minimum Parenthesis InsertionsRubrik · ONSITE INTERVIEWRubrik interview questions
  • N-Queens Solution CounteBay · ONSITE INTERVIEWeBay interview questions
  • N-Queens Solution CountOptimus Information · ONSITE INTERVIEWOptimus Information interview questions
  • Remove Invalid ParenthesesMygate · ONSITE INTERVIEWMygate interview questions
  • Count and Score Distinct Hat AssignmentsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Maximum Currency Conversion Along a Simple PathRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Minimum Stickers to Form a Target StringByteDance · ONSITE INTERVIEWByteDance interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] chooseFiveDisjointWords(String[] words) {
        // Write your code here.
    }
}
Checking account…