July 4th Sale
Limited Time Deal: Unlock all premium questions for over 40% off
$10.42$6.25
10
:
09
:
26
:
09
Back to Dashboard
Prune Prefix Words
Medium
A URL shortener system maintains a keyword list. To reduce redundancy, remove every keyword that is a prefix of any other keyword in the list. A string a is a prefix of string b if b starts with a and len(a) < len(b). Return only the keywords that are not a prefix of any other keyword, preserving their original relative order.
Function: pruneKeywords(keywords: list<string>) -> list<string>
...