Morse Code to English Problem Statement
You are provided with a string of morse code(s) of length N. Your task is to convert this morse code into the corresponding alphanumeric code consisting of lowercase English letters (a-z) and digits (0-9).
The Morse Code Table:
list = [ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----." ]
Note: list[0] corresponds to 'a', list[1] to 'b', and so on, up to list[35] which corresponds to '9'.
Input:
The first line contains an integer 'T' representing the number of test cases. Each test case is presented in the following lines:
Each test case consists of a string containing the morse code.
Output:
For every test case, output the corresponding alphanumeric string on a new line.
Example:
Input:
T = 2
".- -..."
"----."
Output:
ab
9
Constraints:
1 <= T <= 10
1 <= N <= 5*(10^5)
Note: You don't need to print anything. Implement the function accordingly.

AnswerBot
4mo
Convert Morse code to alphanumeric code using a predefined table.
Iterate through the morse code string and convert each morse code to its corresponding alphanumeric character using the given table.
Joi...read more
Help your peers!
Add answer anonymously...
Goldman Sachs Software Developer interview questions & answers
A Software Developer was asked 2mo agoQ. Given a sorted array, find the number of times a specific element appears in the...read more
A Software Developer was asked 2mo agoQ. Given an array, remove elements that appear consecutively for more than k times....read more
A Software Developer was asked 12mo agoQ. What is the difference between OOP and POP?
Popular interview questions of Software Developer
A Software Developer was asked 2mo agoQ1. Given an array, remove elements that appear consecutively for more than k times....read more
A Software Developer was asked 12mo agoQ2. What is the difference between OOP and POP?
A Software Developer was asked Q3. Write a function to select a pivot element randomly in Quick Sort.
>
Goldman Sachs Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

