Hospital Triage Priority
Updated
Problem statement
Patient i arrives at index i with severity severities[i]. Return the 1-based treatment position of patient k.
- Greater severity is treated first.
- If
gendersis empty, equal-severity patients are ordered by earlier arrival. - Otherwise
genders.length == severities.length; at equal severity,Fis treated beforeM, then earlier arrival breaks the remaining tie.
Function
treatmentOrder(severities: int[], genders: String, k: int) → intExamples
Example 1
severities = [3,1,4,4,2]genders = ""k = 2return = 1Patient 2 is the earlier of the two severity-4 patients.
Example 2
severities = [3,1,4,4,2]genders = "MFMFM"k = 2return = 2Patient 3 is female and therefore precedes patient 2 at equal severity.
Constraints
1 <= severities.length <= 1000001 <= severities[i] <= 10^90 <= k < severities.lengthgendersis empty or has the same length asseveritiesand contains onlyMandF.
More Goldman Sachs Phone Screen questions
- Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Hash MapOA · PHONE SCREEN · Seen Nov 2026
- House Robber IIIPHONE SCREEN · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · Seen Nov 2026
- Check a Complete Binary TreePHONE SCREEN · Seen Oct 2026
- Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Count Staircase WaysPHONE SCREEN · Seen Oct 2026
- Is a Power of TenPHONE SCREEN · Seen Oct 2026
- Minimum Traveling Salesperson TourPHONE SCREEN · Seen Oct 2026
- Square Root with Newton IterationPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Majority ElementByteDance · PHONE SCREENByteDance interview questions
- Recommend Films from Viewers Who Watched Everything You DidBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Total Years of Work ExperienceLinkedIn · PHONE SCREENLinkedIn interview questions
- Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
- Employee Count Median, Mean and ModeClay · PHONE SCREEN
- Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
- Assign CookiesAmazon · PHONE SCREEN
- Sort by Checking PermutationsMercor · PHONE SCREENMercor interview questions
- Parse and Sort Integer DataLegora · PHONE SCREEN
- Rank Unseen Items by Embedding SimilarityYahoo · PHONE SCREENYahoo interview questions