Tap here to switch tabs
Problem
Submissions

Problem: Longest Word in Dictionary

Longest Word in Dictionary asks you to find the longest string built character by character from strings in an array. On ties, return the lexicographically smallest string, or an empty string if none qualifies.

Statement

Given an array of strings words, return the longest string in words that can be constructed one character at a time by other strings in words.

If multiple qualifying strings have the same maximum length, return the one that is lexicographically smallest. If no such string exists, return an empty string "".

Constraints:

  • 1≤1 \leq words.length ≤1000\leq 1000

  • 1≤1 \leq words[i].length ≤30\leq 30

  • words[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Word in Dictionary

Longest Word in Dictionary asks you to find the longest string built character by character from strings in an array. On ties, return the lexicographically smallest string, or an empty string if none qualifies.

Statement

Given an array of strings words, return the longest string in words that can be constructed one character at a time by other strings in words.

If multiple qualifying strings have the same maximum length, return the one that is lexicographically smallest. If no such string exists, return an empty string "".

Constraints:

  • 1≤1 \leq words.length ≤1000\leq 1000

  • 1≤1 \leq words[i].length ≤30\leq 30

  • words[i] consists of lowercase English letters.