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

Can the Singer Perform the Song?

PayPal logoPayPal● EasyFULLTIMEPHONE SCREEN

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The note ordering, inclusive vocal range, and reported examples match the source at about 99%; an empty song is defined as singable.

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.

Example 3

song = ["C3","E3","G3","C4","E4","G4","C5"]lowest = "B2"highest = "C5"return = true

Every song note lies within the inclusive range.

Example 4

song = ["C3","E3","G3","C4","E4","G4","C5"]lowest = "C3"highest = "B4"return = false

At least one song note is outside the inclusive range.

Example 5

song = ["B4","F5","B5"]lowest = "B4"highest = "B5"return = true

Every song note lies within the inclusive range.

Example 6

song = ["B4","F5","B5"]lowest = "B4"highest = "C5"return = false

At least one song note is outside the inclusive range.

Example 7

song = ["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"]lowest = "D4"highest = "A5"return = true

Every song note lies within the inclusive range.

Example 8

song = ["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"]lowest = "D4"highest = "G5"return = false

At least one song note is outside the inclusive range.

Example 9

song = ["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"]lowest = "D4"highest = "C6"return = true

Every song note lies within the inclusive range.

Example 10

song = ["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"]lowest = "F4"highest = "C6"return = false

At least one song note is outside the inclusive range.

Example 11

song = ["F4"]lowest = "D4"highest = "E4"return = false

At least one song note is outside the inclusive range.

Constraints

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

More PayPal interview questions

  • Minimum Cost to Merge Values into OneOA · Seen Nov 2026
  • Per-User Sliding-Window Rate LimiterOA · Seen Nov 2026
  • Total Cost Against the Lowest Earlier PriceOA · Seen Nov 2026
  • Items Purchase (For Java Backend Engineer)OA · Seen Nov 2024
  • Find Minimum Price to SpendOA · Seen Oct 2024
  • Modify ArrayOA · Seen Jun 2024
  • Count User Logins 🌿 (Singapore)OA · Seen Mar 2024
  • Similar Password 🪴 (Singapore)OA · Seen Mar 2024

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

PayPal interview experiences

  • PayPal SWE Intern OA Questions: 1 Experience
All PayPal interview questionsSee PayPal hiring insights
Saved
class Solution {
    public boolean singable(String[] song, String lowest, String highest) {
        // Write your code here.
        return false;
    }
}
Checking account…