← 返回 meta 的题目列表Return Minimal Subset of Strings
类型:online_judge
Return Minimal Subset of Strings
Given an array of strings, return a minimal subset such that no other strings are prefixes of the subset.
Example:
Input: ["foo", "food", "foodie", "bar", "baz"]
Output: ["foo","bar","baz"]
Constraints:
String lengths: [0, 20]
Array length: [0, 50]
All strings consist of lowercase letters and are unique.
Example
Input
5
foo food foodie bar baz