FastPrepHospital Triage Priority
Problems/Hospital Triage Priority

Hospital Triage Priority

Goldman Sachs logoGoldman Sachs● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Goldman Sachs interview report gives the full rules for severity, gender priority, arrival order, and the 1-based rank, with examples and constraints. This version has two modes and works across languages. Our version is about 99% the same as the reported question.

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 genders is empty, equal-severity patients are ordered by earlier arrival.
  • Otherwise genders.length == severities.length; at equal severity, F is treated before M, then earlier arrival breaks the remaining tie.

Function

treatmentOrder(severities: int[], genders: String, k: int) → int

Examples

Example 1

severities = [3,1,4,4,2]genders = ""k = 2return = 1

Patient 2 is the earlier of the two severity-4 patients.

Example 2

severities = [3,1,4,4,2]genders = "MFMFM"k = 2return = 2

Patient 3 is female and therefore precedes patient 2 at equal severity.

Constraints

  • 1 <= severities.length <= 100000
  • 1 <= severities[i] <= 10^9
  • 0 <= k < severities.length
  • genders is empty or has the same length as severities and contains only M and F.

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
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public int treatmentOrder(int[] severities, String genders, int k) {
      // write your code here
    }
}
Checking account…