FastPrepDictionary Words Formable From Letters
Problems/Dictionary Words Formable From Letters

Dictionary Words Formable From Letters

Google logoGoogle● EasyNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for all dictionary words that can be built from the given letters. It confirms that a dictionary is provided. We fixed that each letter is used once, that output is in dictionary order, how duplicates work, and how empty strings work. Our version is about 88% the same as the reported question.

Given a lowercase dictionary dictionary and a lowercase string letters, return every dictionary word that can be built from the available letters.

Each occurrence in letters may be used at most once per word. Preserve dictionary order, preserve repeated dictionary entries, and return an empty array when no word is buildable. The empty word can be built from any supplied letters, including none.

Function

wordsFromLetters(dictionary: String[], letters: String) → String[]

Examples

Example 1

dictionary = ["cat","act","taco","dog"]letters = "tac"return = ["cat","act"]

Both cat and act use exactly the three available letters. taco needs an extra letter and dog uses unavailable letters.

Example 2

dictionary = ["a","aa","aaa"]letters = "aa"return = ["a","aa"]

The two available copies of a can build the first two words but not the third.

Example 3

dictionary = []letters = "abc"return = []

An empty dictionary contains no words to return.

Constraints

  • 0 <= dictionary.length <= 100000.
  • 0 <= dictionary[i].length,letters.length <= 100000.
  • The total length of all dictionary words is at most 1000000.
  • All strings contain only lowercase English letters.

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

  • Markov Transition Counts and ProbabilitiesRetool · ONSITE INTERVIEWRetool interview questions
  • Deduplicated Query RegistrationDatadog · ONSITE INTERVIEWDatadog interview questions
  • Count Phrases Formed by Anagram ReplacementWells Fargo · OAWells Fargo interview questions
  • Ransom NoteThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions
  • K-th Non-Repeating Character IndexBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Minimum Deletions to Make Every Letter Count EvenMarshall Wace · OAMarshall Wace interview questions
  • Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
  • Count One-Swap Number PairsCapital One · OACapital One interview questions
  • How Many Sentences?Chubb · OAChubb interview questions
  • Perfect SubstringsVisa · OAVisa 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[] wordsFromLetters(String[] dictionary, String letters) {
        // Write your code here.
    }
}
Checking account…