FastPrepCan the Singer Perform the Song?
Problems/Can the Singer Perform the Song?

Can the Singer Perform the Song?

Walmart logoWalmart● EasyFULLTIMEPHONE SCREEN

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The note grammar, musical order, inclusive vocal range and all eleven reported cases match at about 95%. Empty-song behavior, valid ordered vocal endpoints and the 1,000-note bound are declared practice assumptions. Walmart is the reported hiring client and Karat the provider.

A singer can perform a song only when every note is within the singer's inclusive vocal range. Given song, lowest, and highest, return whether the singer can perform the song.

Each note contains a pitch letter followed by one octave digit. Pitches increase in the order C, D, E, F, G, A, B; octaves increase from 0 through 7. A note in a higher octave is always higher than any note in a lower octave. Within one octave, compare pitch order.

For example, G3 < A3 < B3 < C4 < D4. The lowest possible note is C0, and the highest is B7.

For this exercise, assume all notes and vocal endpoints are valid, lowest is no higher than highest, and an empty song is singable.

Function

singable(song: String[], lowest: String, highest: String) → boolean

Examples

Example 1

song = ["F4","B4","C5"]lowest = "F4"highest = "C5"return = true

Every song note lies within the inclusive range.

Example 2

song = ["F4","B4","C5"]lowest = "A4"highest = "C5"return = false

At least one song note is outside the inclusive range.

Constraints

  • For this exercise, assume 0 <= song.length <= 1000.
  • Each note is exactly one letter from CDEFGAB followed by one digit from 0 through 7.
  • lowest is no higher than highest.

More Walmart Phone Screen questions

  • Count Months Starting on SundayPHONE SCREEN · Seen Aug 2026
  • Longest Even-Length WordPHONE SCREEN · Seen Aug 2026
  • Range ModulePHONE SCREEN · Seen Aug 2026
  • Meeting Rooms IIPHONE SCREEN · Seen Aug 2026
  • Sort Real Number StringsPHONE SCREEN · Seen Jan 2026
  • Check a Password Against a Supplied PolicyPHONE SCREEN · Seen Jun 2025
  • Convert a Restricted Function to an Arrow FunctionPHONE SCREEN · Seen Jun 2025
  • Repair One Missing Function Punctuation CharacterPHONE SCREEN · Seen Jun 2025
  • Rooms With Two Other Entrances and a Treasure SuccessorPHONE SCREEN · Seen Mar 2025
  • First Dictionary Word from Note LettersPHONE SCREEN · Seen Aug 2022

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Parse and Sort Integer DataLegora · PHONE SCREEN
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • Longest All-Present Attendance StreakOracle · PHONE SCREENOracle interview questions
  • Most Frequent NameAmazon · PHONE SCREEN
All Walmart interview questionsSee Walmart hiring insights
Saved
class Solution {
    public boolean singable(String[] song, String lowest, String highest) {
        // Write your code here.
        return false;
    }
}
Checking account…