FastPrepTaste-Test Claim: Chance of Guessing This Well
Problems/Taste-Test Claim: Chance of Guessing This Well

Taste-Test Claim: Chance of Guessing This Well

Hudson River Trading logoHudson River Trading● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Hudson River Trading algorithm developer intern phone screen on probability and statistics. Someone claimed to tell five candy colors apart by taste and named two of three correctly. The follow-up asked about 30 right out of 100.

The report does not say how to judge the claim or how common each color is. Here you return the chance that pure guessing does at least as well, which is the one-sided p-value. Each guess is right one time in c, as if every color is equally common. Both reported cases are examples. Choosing a cutoff and discussing what the numbers mean is left to the editorial.

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

Return the probability that a person who is only guessing gets k or more right out of n candies, when each guess is right with probability 1/c, independently for each candy.

This tests a claim. Someone says they can tell the color of a chocolate candy by taste alone. There are c colors. In a test they taste n candies, name a color for each one, and get k of them right.

Note: this is the one-sided p-value for the claim. A small value means pure guessing rarely does this well, which counts as evidence for the claim.

Function

tasteTestPValue(c: int, n: int, k: int) → double

Examples

Example 1

c = 5n = 3k = 2return = 0.1040000000

Exactly two right has probability 3 * 0.2^2 * 0.8 = 0.096, and three right has 0.2^3 = 0.008. The total is 0.104, so guessing does this well about one time in ten. That is weak evidence for the claim.

Example 2

c = 5n = 100k = 30return = 0.0112489787

A guesser expects 100 * 0.2 = 20 right. Getting 30 or more has probability about 0.0112, so guessing rarely does this well. That is much stronger evidence for the claim.

Example 3

c = 2n = 4k = 0return = 1.0000000000

Every result has 0 or more right answers, so the probability is 1.

Constraints

  • 2 <= c <= 100
  • 1 <= n <= 1000
  • 0 <= k <= n
  • Answers within 10^-9 of the correct value are accepted.

More Hudson River Trading Phone Screen questions

  • Format a Signed Integer with CommasPHONE SCREEN · Seen Nov 2026
  • Order and Batch Open-Close LifecyclePHONE SCREEN · Seen Nov 2026
  • Tilting Maze BallPHONE SCREEN · Seen Oct 2026
  • Tiered Expiring Item StorePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Mean vs Median: Chance of Missing the CenterPHONE SCREEN · Seen Sep 2026
  • Market Data Signal WatcherPHONE SCREEN · Seen Jul 2026
  • Integer to String Without Built-insPHONE SCREEN · Seen May 2026
  • Contact Tracing Through Timed MeetingsPHONE SCREEN · Seen Nov 2024
  • Polydivisible Pandigital NumbersPHONE SCREEN · Seen Feb 2024
  • Defragment a Buffer of ObjectsPHONE SCREEN · Seen Nov 2023

Similar questions at other companies

  • Best Single Reroll for Five DiceSusquehanna International Group (SIG) · PHONE SCREENSusquehanna International Group (SIG) interview questions
  • Expected Rank of the Hired CandidateJane Street · PHONE SCREENJane Street 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

Interview reports that mention this question

  • Hudson River Trading interviews · 2023

Hudson River Trading interview experiences

  • Hudson River Trading Data Science Interviews: 2 Experiences
  • Hudson River Trading interviews · 2021
  • Hudson River Trading OA · 2021
  • Hudson River Trading interviews · 2022
  • Hudson River Trading OA · 2022
All Hudson River Trading interview questionsSee Hudson River Trading hiring insights
Saved
class Solution {
    public double tasteTestPValue(int c, int n, int k) {
        // Write your code here.
    }
}
Checking account…