Back to problems

Decode Morse Code to All Possible Original Strings

Algorithm · Oscar Health · Medium

Given a Morse-encoding map for the lowercase letters a-z and a string code made exclusively of . and -, produce every lowercase string whose letters encode to exactly code. Because Morse encodings are not prefix-free, the same Morse string may correspond to more than one original string. A suitable interface is: Input code: a Morse string containing only . and - morse_map: a mapping from a-z to their Morse representations Output Return a list containing all decoded strings.…

Checking your access…