Otter AI Frontend Engineer Phone Screen Interview Experience
Interview Experience
Problem Description Determine if a singer can perform a specific song based on their vocal range. A song is considered singable if and only if every note in the song falls within the inclusive ran
Full Details
Problem Description Determine if a singer can perform a specific song based on their vocal range. A song is considered singable if and only if every note in the song falls within the inclusive range defined by the singer's lowest and highest achievable notes. Note Representation and Ordering Notes are represented by a string containing a pitch letter followed by an octave number (e.g., "C5"). * Pitch Order (Lowest to Highest): C, D, E, F, G, A, B * Octave Order (Lowest to Highest): 0, 1, 2, 3, 4, 5, 6, 7 Comparison Logic 1. Octave Priority: A note with a larger octave number is always higher than a note with a smaller octave number (e.g., C4 is higher than B3). 2. Pitch Priority: If two notes share the same octave, the note with the later pitch letter is higher (e.g., A3 is higher than G3). 3. Bounds: The absolute lowest note is C0 and the highest is B7. Function Specification * Input: * song: A list of strings representing the notes in the song. * lowest: A string representing the lowest note the singer can reach. * highest: A string representing the highest note the singer can reach. * Output: Boolean (True if all notes are within range, False otherwise). * Complexity Variable: N = length of the song. Test Data and Expected Results Data Sets: * song1 = ["F4", "B4", "C5"] * song2 = ["C3", "E3", "G3", "C4", "E4", "G4", "C5"] * song3 = ["B4", "F5", "B5"] * song4 = ["B4", "E4", "G4", "G4", "A4", "B4", "E4", "B4", "E4", "G4", "G4", "A4", "C5", "B4", "E5", "G4", "G4", "A4", "B4", "C5", "D5", "C5", "B4", "C5", "E5", "D5", "C5", "C5", "B4", "B4", "E5", "E4", "G4", "G4", "A4", "B4", "B4", "B4", "C5", "E5", "A5", "E5", "C5", "A4", "E5", "D5", "C5", "B4"] * song5 = ["F4"] Test Cases: 1. singable(song1, "F4", "C5") $\to$ True (All notes within bounds) 2. singable(song1, "A4", "C5") $\to$ False (F4 is lower than A4) 3. singable(song2, "B2", "C5") $\to$ True 4. singable(song2, "C3", "B4") $\to$ False (C5 is higher than B4) 5. singable(song3, "B4", "B5") $\to$ True 6. singable(song3, "B4", "C5") $\to$ False (F5 and B5 are higher than C5) 7. singable(song4, "D4", "A5") $\to$ True 8. singable(song4, "D4", "G5") $\to$ False (A5 is higher than G5) 9. singable(song4, "D4", "C6") $\to$ True 10. singable(song4, "F4", "C6") $\to$ False (E4 is lower than F4) 11. singable(song5, "D4", "E4") $\to$ False (F4 is higher than E4)