Bloomberg | Phone Screening | Sort a list of words using a special alphabet

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2020-07-20Added By Anonymous
Source: Link
Company: Bloomberg
Role: unknown
Interview Stage: Phone Screening
Location: unknown
Year: unknown

Original Post:
Given a special alphabet (alien dictionary?) sort a list of words in ascedning order alphabetically: alphabet: "a", "b", "c", "ch", "d", "dd", "e", "f", "ff", "g", "ng", "h", "i", "l", "ll", "m", "n", "o", "p", "ph", "r", "rh", "s", "t", "th", "u", "w", "y" Input: "dd r", "n a h", "d e a", "dd", "ng a h" Output: "dea", "dd", "ddr", "ngah", "nah" Not sure if a similar question exists in LC, if so please let me know
Comments