Interview Question for Software Developers
- 0of 0 votes
AnswersMorse code is a method of transmitting text information as series of long and short sounds or visual signals. Pauses are used during transmission to group letters and words. The common convention for writing morse code is to use dots (.) and dashes (-) for the short and long signals however without including pauses (e.g. as spaces) morse code quickly becomes ambiguous. For example the code -....--.... has 13 valid translations (bans, bates, bath, begs, digs, etc)
- K14 October 03, 2018 in India
Write a function getAllEnglishTranslations which takes a morse code without any pauses and returns all valid translations.
std::vector<std::string> getAllEnglishTranslations(std::string morseCode)
Output must be sorted in ascending alphabetical order.
Assume there are only 7 alphabets and below are their mappings
M = dash-dash (--)
C = dash-dot-dash-dot (-.-.)
O = dash-dash-dash (---)
D = dash-dot-dot (-..)
I = dot-dot (..)
N = dash-dot (-.)
G = dash-dash-dot (--.)
Assume input code is a valid morse code| Report Duplicate | Flag | PURGE
Software Developer