Retired

Shortest unique prefixes for every word in a list (retired)

Description:

Given an array of unique words, return an array containing the shortest unique prefix for each word in the list. Please assume that no word in the input array is the prefix of another word. For example, you will never have an input array containing "kata" and "katas".

For example:

Input: [ 'zebra', 'dog', 'duck', 'dove' ]

Output: [ 'z', 'dog', 'du', 'dov' ]

*Note: prefixes do not have to be returned in any particular order.

Algorithms

Stats:

CreatedSep 27, 2016
Warriors Trained36
Total Skips1
Total Code Submissions33
Total Times Completed12
JavaScript Completions12
Total Stars3
% of votes with a positive feedback rating38% of 4
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes2
Total Rank Assessments3
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • john-bai Avatar
Ad