FastPrepAll English Decodings of Morse Code
Problems/All English Decodings of Morse Code

All English Decodings of Morse Code

Oscar Health logoOscar Health● MediumFULLTIMEPHONE SCREEN

Updated Dec 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported from a first backend interview round at Oscar Health in November 2026. It was the second of two coding tasks. The first turned English into Morse code; this one went back the other way and asked for every English reading of a Morse string. The candidate says they used depth-first search and estimated the cost as quadratic. The report gives no input format, code table, output order, limits or examples.

So the details are ours. We assume the letter codes are written back to back with no separator, use the standard international code for the 26 letters, accept any letter sequence rather than only dictionary words, return lowercase strings in lexicographic order, and cap the input at 10 symbols, because the number of readings almost doubles with each extra symbol. All three examples are ours.

Our version is about 60% the same as the reported question.

You are given a string morse made of the characters . (dot) and - (dash). It is the Morse code of a sequence of English letters, written with the codes from the table below. The codes of the letters are written one right after another, with no spaces or other separators between them, so one string can come from more than one sequence of letters.

Return every string of lowercase letters whose codes, written one after another, give exactly morse. Return the strings in lexicographic (dictionary) order. Any sequence of letters counts; it does not have to be a real English word.

International Morse code for the 26 letters
LetterCodeLetterCode
a.-n-.
b-...o---
c-.-.p.--.
d-..q--.-
e.r.-.
f..-.s...
g--.t-
h....u..-
i..v...-
j.---w.--
k-.-x-..-
l.-..y-.--
m--z--..

Function

decodeAll(morse: String) → List<String>

Examples

Example 1

morse = ".-"return = ["a","et"]

.- is the code of a. It can also be read as . (e) followed by - (t). In lexicographic order the answer is ["a","et"].

Example 2

morse = "..."return = ["eee","ei","ie","s"]

A | marks where one letter code ends and the next begins. Three dots can be cut as .|.|. (eee), .|.. (ei), ..|. (ie) or ... as one piece (s). Sorted: ["eee","ei","ie","s"].

Example 3

morse = "-.-"return = ["k","nt","ta","tet"]

-.- is k. Cut as -.|- it is nt, as -|.- it is ta, and as -|.|- it is tet. The code of c, -.-., is longer than the whole string, so c cannot be used.

Constraints

  • 1 <= morse.length <= 10
  • morse consists only of the characters . and -.

More Oscar Health interview questions

  • English to Morse CodePHONE SCREEN · Seen Dec 2026
  • Longest Name Chain in a Directed Acyclic GraphPHONE SCREEN · Seen Sep 2026
  • Members Lacking Provider Network AccessONSITE INTERVIEW · Seen Apr 2026

Similar questions at other companies

  • Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
  • Phone-Number Letter CombinationsHeadway · PHONE SCREENHeadway interview questions
  • Letter Combinations of a Phone NumberLinkedIn · PHONE SCREENLinkedIn interview questions
  • String Permutations in Custom Character OrderWex · OA · PHONE SCREEN
  • Numeric Poker OperationsRippling · PHONE SCREENRippling interview questions
  • Unique String PermutationsAmazon · PHONE SCREEN
  • Permutations of Unique CharactersSalesforce · PHONE SCREENSalesforce interview questions
  • Count Prefix Paths in a Character GraphGoogle · PHONE SCREENGoogle interview questions
  • Sorted Subsets of a StringMicrosoft · PHONE SCREENMicrosoft interview questions
  • Maximum Unique Substring SplitThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
See Oscar Health hiring insights
Saved
class Solution {
    public List<String> decodeAll(String morse) {
      // Write your code here.
    }

}
Checking account…