FastPrepEnough Muffins for the Line
Problems/Enough Muffins for the Line

Enough Muffins for the Line

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

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report described a bakery question from SIG's online assessment. Each customer buys one item and wants a muffin or a croissant with fixed chances. A few muffins are left for a short line, and you find the chance that nobody is left wanting a muffin after they run out.

The report has only one case: 5 customers, 2 muffins and a 30% muffin chance. Here, the line length n (1 to 1000), the muffins left m (0 to 1000) and the muffin chance (a whole percent) are inputs. Customers choose independently, croissants never run out, 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.

A bakery has m muffins left, and n customers are waiting in line. Each customer buys exactly one item. Each customer wants a muffin with probability muffinPercent percent and otherwise wants a croissant, independently of everyone else. There are always enough croissants.

The customers are served one at a time. The muffins are enough if no customer wants a muffin after the muffins have run out.

Return the probability that the muffins are enough. Answers within 10^-9 of the exact value are accepted.

Function

enoughMuffinsProbability(n: int, m: int, muffinPercent: int) → double

Examples

Example 1

n = 5m = 2muffinPercent = 30return = 0.83692

This is the interview case. The muffins are enough when at most 2 of the 5 customers want one. No one wants a muffin with probability 0.7^5 = 0.16807. Exactly one wants a muffin with probability 5 * 0.3 * 0.7^4 = 0.36015. Exactly two want one with probability 10 * 0.3^2 * 0.7^3 = 0.3087. The answer is 0.16807 + 0.36015 + 0.3087 = 0.83692.

Example 2

n = 3m = 0muffinPercent = 50return = 0.125

There are no muffins, so the muffins are enough only if none of the 3 customers wants one. That happens with probability 0.5^3 = 0.125.

Example 3

n = 4m = 1muffinPercent = 50return = 0.3125

One muffin is enough when at most one of the 4 customers wants a muffin. Of the 16 equally likely want patterns, 1 has no muffin requests and 4 have exactly one. The answer is 5/16 = 0.3125.

Constraints

  • 1 <= n <= 1000
  • 0 <= m <= 1000
  • 0 <= muffinPercent <= 100

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
  • 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
  • Knights, Knaves and Their StatementsOA · Seen Nov 2026

Similar questions at other companies

  • Count Nondecreasing Digit-Sum ArraysMicrosoft · OAMicrosoft interview questions
  • Stable Workload Redistribution TreesTower Research Capital · OA
  • Count Valid A-B-C Sequences Under a Modulo-Four RuleInfosys · OAInfosys interview questions
  • Count Shipment SchedulesMorgan Stanley · OAMorgan Stanley interview questions
  • Count Permutations Without Three Equal Parities in a RowGoogle · OAGoogle interview questions
  • Find Encrypted NumberAmazon · OA
  • Valid PasswordsMathWorks · OAMathWorks interview questions
  • Coloring HousesSnowflake · OASnowflake interview questions
  • Find Maximum Number of StringsMoveworks · OAMoveworks interview questions
  • Count Distinct Binary Search TreesC3.ai · OAC3.ai interview questions

Interview reports that mention this question

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

Susquehanna International Group (SIG) interview 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 enoughMuffinsProbability(int n, int m, int muffinPercent) {
        // Write your code here.
    }
}
Checking account…