FastPrepExpected Rank of the Hired Candidate
Problems/Expected Rank of the Hired Candidate

Expected Rank of the Hired Candidate

Jane Street logoJane Street● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in one Jane Street trade desk operations report from London, posted in 2026. After an Excel take-home, its brainteaser round included a three-candidate version of the classic secretary problem whose answer was an expected value. The report does not say which quantity was wanted or which hiring rule was used.

We chose the quantity (the expected rank of the person hired), the rule of passing over a fixed number of candidates and then hiring the first one better than all before, hiring the last candidate when nobody else qualified, any number of candidates and any cutoff, the limits, the tolerance and all three examples.

Our version is about 60% the same as the reported question.

You are hiring for one job and will interview n candidates one at a time. The candidates have ranks 1 to n, where rank 1 is the best and no two candidates share a rank. They arrive in a uniformly random order, so every order is equally likely.

After each interview you must hire the candidate or turn them away for good, and you can only compare a candidate with those you have already seen. You follow this rule:

  • Turn away the first cutoff candidates, whoever they are.
  • After that, hire the first candidate who is better than every candidate interviewed before them.
  • If nobody has been hired when the last candidate arrives, hire the last candidate.

Return the expected rank of the candidate you hire. Answers within 10-6 of the correct value, or within that fraction of it when the answer is above 1, are accepted.

Function

secretaryExpectedRank(n: int, cutoff: int) → double

Examples

Example 1

n = 3cutoff = 1return = 1.6666666666666667

Write each arrival order as the ranks in the order they arrive. The first candidate is always passed over. In [2,1,3], [3,1,2] and [3,2,1] the second candidate beats the first and is hired (ranks 1, 1, 2). In [2,3,1] the third candidate beats both earlier ones and is hired (rank 1). In [1,3,2] and [1,2,3] nobody qualifies, so the last candidate is hired (ranks 2, 3). The average is 10 / 6 = 5/3.

Example 2

n = 3cutoff = 0return = 2.0

With no one passed over, the first candidate already beats everyone seen so far and is hired. Their rank is equally likely to be 1, 2 or 3, so the answer is 2.

Example 3

n = 4cutoff = 2return = 2.0833333333333335

The third candidate is hired when they beat the first two, which happens with chance 1/3; they are then the best of three random ranks out of four, with average rank 5/4. Otherwise the fourth candidate is hired, with average rank 5/2. The answer is 1/3 * 5/4 + 2/3 * 5/2 = 25/12.

Constraints

  • 1 <= n <= 105
  • 0 <= cutoff < n

More Jane Street Phone Screen questions

  • Maximum-Scoring Consecutive Tree LevelsPHONE SCREEN · Seen Nov 2026
  • Tree Selection and VisibilityPHONE SCREEN · Seen Nov 2026
  • Load/Store Arithmetic InterpreterPHONE SCREEN · Seen Oct 2026
  • Instrument Stack Language JumpsPHONE SCREEN · Seen Oct 2026
  • Run a Stack Language InterpreterPHONE SCREEN · Seen Oct 2026
  • Positive-Integer Expression EvaluationPHONE SCREEN · Seen Oct 2026
  • Add Two Integers Given as StringsPHONE SCREEN · Seen Sep 2026
  • Angle Between Clock HandsPHONE SCREEN · Seen Jul 2026
  • Route Length From Two CyclistsPHONE SCREEN · Seen Jul 2026
  • Sort TradesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026

Similar questions at other companies

  • Best Single Reroll for Five DiceSusquehanna International Group (SIG) · PHONE SCREENSusquehanna International Group (SIG) interview questions
  • Count Array DerangementsInMobi · PHONE SCREENInMobi interview questions
  • Biased Coin: Probability of Exactly h HeadsAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Revolver: Will the Next Shot Fire?Tower Research Capital · PHONE SCREEN
  • Probability of Consecutive HeadsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Expected Fake-Name CollisionsMercor · PHONE SCREENMercor interview questions
  • Election District Budget Allocation AnalysisIMC Trading · PHONE SCREENIMC Trading interview questions
  • Count Clean Attendance LogsRippling · PHONE SCREENRippling interview questions
  • Extra Coin Win ProbabilityMicrosoft · PHONE SCREENMicrosoft interview questions
  • Count Staircases with Strictly Increasing StepseBay · ONSITE INTERVIEWeBay interview questions

Interview reports that mention this question

  • Jane Street TDOE UK Coding Round: 15 Experiences (Part 3 of 10)
  • Jane Street TDOE Interviews: 165 Experiences (Part 1 of 10)

Jane Street interview experiences

  • Jane Street TDO UK and Hong Kong: 22 Experiences (Part 10 of 10)
  • Jane Street TDOE US Final Round: 11 Experiences (Part 5 of 10)
  • Jane Street TDO Phone Math Round: 26 Experiences (Part 9 of 10)
  • Jane Street TDOE UK Phone Screen: 15 Experiences (Part 4 of 10)
All Jane Street interview questionsSee Jane Street hiring insights
Saved
class Solution {
    public double secretaryExpectedRank(int n, int cutoff) {
      // Write your code here.
    }
}
Checking account…