FastPrepFirst Dictionary Word from Note Letters
Problems/First Dictionary Word from Note Letters

First Dictionary Word from Note Letters

Walmart logoWalmart● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported dictionary-word-from-note task matches at about 95%; first-match selection where unspecified, occurrence counts, independent candidate checks, valid alphabet, no-match behavior and bounds are stated practice assumptions.

You are given a string note and an array words, which is the dictionary. Return the first word in words that you can form by picking letters from note and rearranging them. The first word means the one with the smallest index in the dictionary.

Each copy of a letter in note can be used at most once per word. The letters you pick may sit anywhere in the note and in any order. Check each word on its own: a word you cannot form uses up nothing.

All characters are lowercase English letters. Every dictionary word is nonempty, but the note and the dictionary may be empty. If no word can be formed, return the empty string.

Function

firstWord(note: String, words: String[]) → String

Examples

Example 1

note = "drctkla"words = ["cat","dada","breath","taking","doll"]return = "cat"

The note supplies c, a and t, so cat, the first word, can be formed.

Example 2

note = "rdatlbohe"words = ["cat","dada","breath","taking","doll"]return = "breath"

The note has no c, so cat fails. dada needs two d's, but the note has only one. breath needs b, r, e, a, t and h, and the note has all of them. The answer is breath.

Example 3

note = "ab"words = ["aa","ba"]return = "ba"

aa needs two a's, but the note has only one, so it fails. That failed check uses up nothing, so ba is checked against the whole note. The note has a b and an a, so the answer is ba.

Constraints

  • 0 <= note.length <= 2000
  • 0 <= words.length <= 200
  • Each word contains from 1 through 500 lowercase English letters.

More Walmart Phone Screen questions

  • Count Months Starting on SundayPHONE SCREEN · Seen Aug 2026
  • Longest Even-Length WordPHONE SCREEN · Seen Aug 2026
  • Range ModulePHONE SCREEN · Seen Aug 2026
  • Meeting Rooms IIPHONE SCREEN · Seen Aug 2026
  • Sort Real Number StringsPHONE SCREEN · Seen Jan 2026
  • Check a Password Against a Supplied PolicyPHONE SCREEN · Seen Jun 2025
  • Convert a Restricted Function to an Arrow FunctionPHONE SCREEN · Seen Jun 2025
  • Repair One Missing Function Punctuation CharacterPHONE SCREEN · Seen Jun 2025
  • Can the Singer Perform the Song?PHONE SCREEN · Seen Mar 2025
  • Rooms With Two Other Entrances and a Treasure SuccessorPHONE SCREEN · Seen Mar 2025

Similar questions at other companies

  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • First Letter to Appear TwiceCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
  • Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Known Words Matching Phone DigitsLinkedIn · PHONE SCREENLinkedIn interview questions
  • First Non-Repeated CharacterDell Technologies · PHONE SCREENDell Technologies interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • First Non-Repeating CharacterGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
All Walmart interview questionsSee Walmart hiring insights
Saved
class Solution {
    public String firstWord(String note, String[] words) {
        // Write your code here.
        return "";
    }
}
Checking account…