Square: Shortest Unique Prefix
3 min readSep 6, 2020
Problem:
Given a list of words, return the shortest unique prefix of each word. For example, given the list:
dog
cat
apple
apricot
fist
Return the list:
d
c
app
apr
f
Given a list of words, return the shortest unique prefix of each word. For example, given the list:
dog
cat
apple
apricot
fist
Return the list:
d
c
app
apr
f
Solutions to programming interview questions at some of the top companies in the world: cppcodingzen.com