Daily Coding Day One Sixty Two
Oh beautiful, for spacious skies, for Amber waves of …
1 | Given a list of words, return the shortest unique prefix of each word. |
I used a dictionary on this bad boy and am just keeping track of the count. Does not seem wildly efficient, and honestly I’m not sure I even understand the question but Wynaut:
1 | import Foundation |
Given some inputlet words = ["dog", "cat", "apple", "apricot", "fish"]
and callingprint(shortestUniquePrefixes(words))
would print["d", "c", "app", "apr", "f"]