FastPrepHow Good Are the Estimates of n?
Problems/How Good Are the Estimates of n?

How Good Are the Estimates of n?

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An internship report posted in December 2018 recounts the final phone round at SIG, led by the head of quant research. One topic was estimating the unknown upper end n of the numbers 1 to n from a random sample of m of them. The author offered two estimates, one built on the largest value seen (maximum likelihood) and one on the sample average (method of moments). The discussion moved on to what makes an estimator good: bias, spread and consistency.

The report gives no numbers, input format or required precision, and the post does not settle whether a number can come up twice. In a later reply the author said they took it to be a simple random sample in which repeats were allowed. We chose that the m numbers are all different (every set of m numbers equally likely). This is the classic serial-number setting, where the bias-corrected largest number is the best unbiased estimate, and it is the only version the editorial covers. n (1 to 10^6) and m (1 to n) are inputs. The estimators are the largest number, twice the mean minus 1, and the bias-corrected largest number (m + 1) / m × largest - 1. The function returns the chosen estimator's mean squared error, which combines its bias and its variance. Answers within 10^-9 (absolute or relative) are accepted.

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

The numbers 1, 2, ..., n are in a hat. You draw m different numbers, so every set of m numbers is equally likely. Let M be the largest number drawn and A the average of the numbers drawn. Someone who does not know n estimates it in one of three ways:

  • estimator = 0: the largest number, M.
  • estimator = 1: twice the average minus one, 2A - 1.
  • estimator = 2: the corrected largest number, (m + 1) / m × M - 1.

Return the mean squared error of the chosen estimate: the expected value of (estimate - n)^2.

Your answer is accepted if its absolute error or its relative error is at most 10^-9.

Function

estimatorMse(n: int, m: int, estimator: int) → double

Examples

Example 1

n = 10m = 3estimator = 0return = 5.95

Three numbers from 1 to 10, estimated by the largest one. On average the largest is 3 × 11 / 4 = 33/4, so it is 7/4 too low (the bias). Its variance is 231/80. The mean squared error is 231/80 + (7/4)^2 = 231/80 + 245/80 = 119/20 = 5.95.

Example 2

n = 10m = 3estimator = 1return = 8.555555555555555

The average of the draws is 11/2 on average, so 2A - 1 has no bias. One draw has variance (10^2 - 1) / 12 = 33/4, and the average of 3 different draws has variance 33/4 / 3 × (10 - 3) / (10 - 1) = 77/36. So 2A - 1 has mean squared error 4 × 77/36 = 77/9, about 8.556.

Example 3

n = 10m = 3estimator = 2return = 5.133333333333334

The corrected estimate 4/3 × M - 1 has no bias, and its variance is (4/3)^2 × 231/80 = 77/15, about 5.133. It beats both other estimators here.

Constraints

  • 1 <= m <= n <= 10^6
  • 0 <= estimator <= 2

More Susquehanna International Group (SIG) Phone Screen questions

  • Dice Sum That Is a Multiple of mPHONE SCREEN · Seen Nov 2026
  • Find Median from Data StreamPHONE SCREEN · Seen Nov 2026
  • Painting Arcs to Nearest Neighbors on a CirclePHONE SCREEN · Seen Sep 2026
  • Filter Movies by Inclusive Year RangePHONE SCREEN · Seen Jul 2026
  • Best Single Reroll for Five DicePHONE SCREEN · Seen Feb 2026
  • Catching the Bus to the MoviePHONE SCREEN · Seen Jan 2026
  • Two Dice Summing to a TargetPHONE SCREEN · Seen Jan 2026
  • Median of Uniform Draws in an IntervalPHONE SCREEN · Seen Oct 2025
  • One Number Is the Average of the Other TwoPHONE SCREEN · Seen Jun 2025
  • Which Coin Pattern Shows Up FirstPHONE SCREEN · Seen May 2025

Similar questions at other companies

  • Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions
  • Dice-Walk Winning ProbabilityGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Logistic Regression with Gradient DescentYahoo · PHONE SCREENYahoo interview questions
  • Evaluate an Arithmetic Expression Written in WordsBrex · PHONE SCREEN
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • Integer to English Words in USD and INR StylesVeeam · PHONE SCREEN
  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions
  • Sum of Smallest Non-DivisorsThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Square Root FunctionCitadel · PHONE SCREENCitadel interview questions
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions

Interview reports that mention this question

  • SIG Quant Research Intern Interviews: 60 Experiences

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 Experiences
  • SIG Quant Researcher Intern Interviews: 1 Experience
  • SIG Quant Second-Round Tech Screen: 1 Experience
All Susquehanna International Group (SIG) interview questionsSee Susquehanna International Group (SIG) hiring insights
Saved
class Solution {
    public double estimatorMse(int n, int m, int estimator) {
        // Write your code here.
    }
}
Checking account…