FastPrepLines of Two Kinds of Cookies
Problems/Lines of Two Kinds of Cookies

Lines of Two Kinds of Cookies

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

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2024 SIG online assessment for a quant researcher role asked for the number of different lines of 7 cookies you can make from 6 identical cookies of one kind and 8 of another.

The report gives only that one case and no input format. Here, the two supplies and the line length are inputs (up to 50 each). The interview numbers are the first example, and you return the exact count.

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

You have a sugar cookies and b ginger cookies. Cookies of the same kind look exactly alike. You pick k of these cookies and put them in a straight line.

Two lines are different if at least one spot holds a different kind of cookie. Swapping two cookies of the same kind does not make a new line.

Return the number of different lines you can make.

Function

countCookieLines(a: int, b: int, k: int) → long

Examples

Example 1

a = 6b = 8k = 7return = 127

This is the interview case. Each of the 7 spots holds a sugar or a ginger cookie, so without any limit there would be 2^7 = 128 lines.

There are 8 ginger cookies, more than 7, so ginger never runs out. There are only 6 sugar cookies, so the one line with 7 sugar cookies is impossible. The answer is 128 - 1 = 127.

Example 2

a = 2b = 2k = 3return = 6

Without limits there are 2^3 = 8 lines. With only two cookies of each kind, the lines with three sugar cookies or three ginger cookies cannot be made. The answer is 8 - 2 = 6.

Example 3

a = 1b = 3k = 4return = 4

There are only 3 ginger cookies, so a line of 4 must use the one sugar cookie. The only choice left is where it goes: one of the 4 spots. The answer is 4.

Constraints

  • 0 <= a, b <= 50
  • 1 <= k <= 50
  • k <= a + b

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

  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Subarray SumVisa · OAVisa interview questions
  • Drawing EdgeWeRide · OAWeRide interview questions
  • Drawing EdgeIBM · OAIBM interview questions
  • Drawing EdgeSnowflake · OASnowflake interview questions
  • Process SchedulingCitadel · OACitadel interview questions
  • Unique Digits in RangeAgoda · OAAgoda interview questions
  • Ordered Book Displays with a Featured BookIMC Trading · OAIMC Trading interview questions
  • Find Max Number of PairsRoblox · OARoblox interview questions
  • Count Nondecreasing Digit-Sum ArraysMicrosoft · OAMicrosoft interview questions

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 long countCookieLines(int a, int b, int k) {
        // Write your code here.
    }
}
Checking account…