FastPrepWhich Factory Made the Red Widgets
Problems/Which Factory Made the Red Widgets

Which Factory Made the Red Widgets

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report described a two-factory question from SIG's online assessment. Each factory makes red widgets at its own rate, one factory is picked at random, two widgets from it are both red, and you find the chance they came from the first factory.

The report has only one case, with red rates of 40% and 80%. Here, both rates (whole percents from 1 to 100) and the number of red widgets k (1 to 1000) are inputs. Each widget is red independently of the others, and answers within 10^-9 are accepted. The interview case is the first example.

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

Two factories make widgets, and every widget is either red or black. At Factory A, each widget is red with probability percentA percent. At Factory B, each widget is red with probability percentB percent. The color of each widget does not depend on any other widget.

One of the two factories is picked at random, each with probability 1/2. Then k widgets are taken from that factory, and all k of them are red.

Return the probability that the widgets came from Factory A. Answers within 10^-9 of the exact value are accepted.

Function

factoryAProbability(percentA: int, percentB: int, k: int) → double

Examples

Example 1

percentA = 40percentB = 80k = 2return = 0.2

This is the interview case. From Factory A, two red widgets in a row have probability 0.4 * 0.4 = 0.16. From Factory B, the probability is 0.8 * 0.8 = 0.64. Each factory is picked half the time, so two red widgets happen with probability 0.5 * 0.16 + 0.5 * 0.64 = 0.4, and 0.5 * 0.16 = 0.08 of that comes from Factory A. The answer is 0.08 / 0.4 = 0.2.

Example 2

percentA = 40percentB = 80k = 1return = 0.3333333333333333

Now only one widget is seen. The answer is 0.5 * 0.4 / (0.5 * 0.4 + 0.5 * 0.8) = 0.2 / 0.6 = 1/3. Seeing a second red widget in Example 1 makes Factory A even less likely.

Example 3

percentA = 90percentB = 30k = 3return = 0.9642857142857143

Factory A makes red widgets more often. Three red widgets have probability 0.9^3 = 0.729 from Factory A and 0.3^3 = 0.027 from Factory B. The answer is 0.729 / (0.729 + 0.027) = 27/28, about 0.9642857143.

Constraints

  • 1 <= percentA <= 100
  • 1 <= percentB <= 100
  • 1 <= k <= 1000

More Susquehanna International Group (SIG) Online Assessment questions

  • Catch Fish with Reusable BaitsOA · Seen Nov 2026
  • Bold Play to Reach a GoalOA · Seen Nov 2026
  • Cats, Truth and Who Has MoreOA · Seen Nov 2026
  • Counting Cows by Their LegsOA · Seen Nov 2026
  • Enough Muffins for the LineOA · Seen Nov 2026
  • Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
  • Four-by-Four Boundary GridOA · Seen Nov 2026
  • Frog Paths Without Long RunsOA · Seen Nov 2026
  • Higher Roll, or Lose the SumOA · Seen Nov 2026
  • Is a Popular Story Fake?OA · Seen Nov 2026

Similar questions at other companies

  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions
  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA
  • Address on Same PageNVIDIA · OANVIDIA interview questions
  • Preorder of a Special Binary TreeNielsen · OA

Interview reports that mention this question

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 Experiences

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Research Intern Interviews: 60 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 factoryAProbability(int percentA, int percentB, int k) {
        // Write your code here.
    }
}
Checking account…