PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Jane Street

Solve queue switch and coin change puzzles

Last updated: Mar 29, 2026

Quick Overview

This two-part question evaluates probabilistic reasoning about expected waiting times with random queue switching and combinatorial/algorithmic counting for coin-change combinations, testing skills in probability, expectation and order statistics as well as combinatorics and dynamic programming within the Coding & Algorithms domain.

  • medium
  • Jane Street
  • Coding & Algorithms
  • Data Scientist

Solve queue switch and coin change puzzles

Company: Jane Street

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

This entry contains two separate interview-style quantitative/algorithmic questions. --- ## 1. Queue switching decision problem You are standing in a single FIFO queue of 100 customers waiting for service at a checkout counter. Customers are served one at a time, and each service takes the same fixed amount of time (say, one time unit). Positions are numbered `1` (front of the line, served next) through `100` (back of the line). At time 0, a second identical checkout counter opens. Each of the other 99 customers independently decides to move to the new queue with probability 1/2. All those who choose to move (possibly including you) are randomly ordered in the new queue; every ordering of the movers is equally likely. Both checkout counters start serving at the same time and serve at the same rate (one customer per time unit) from their respective queues. You are currently at position `k` in the original queue (1 ≤ k ≤ 100). You must decide **once** at time 0 whether to stay in the original queue or move to the new one. 1. Derive an expression for your **expected waiting time** until service if you **stay** in the original queue as a function of `k`. 2. Derive an expression for your **expected waiting time** until service if you **switch** to the new queue, taking into account that: - Each of the other 99 customers moves independently with probability 1/2. - If you move, your position among all movers is uniformly random. - Both queues are then served in parallel at the same rate. 3. For which values of `k` is it **better in expectation** (i.e., gives a lower expected waiting time) to switch rather than stay? Give the threshold value(s) of `k` where your preference changes. You may assume that everyone else’s decision to move or stay is independent of your own and of their position; you are not required to model strategic behavior. --- ## 2. Coin change combinations with US-style denominations You are given an integer amount `n` representing a value in **cents** and you have an unlimited supply of the following coin denominations: - 1 cent - 5 cents - 10 cents - 25 cents - 100 cents (i.e., 1 dollar) You want to know in how many **distinct combinations** (multisets) you can make exactly `n` cents using these coins. The **order of coins does not matter**; for example, `1 + 5` is the same combination as `5 + 1`. **Task:** 1. Define the problem formally in terms of counting integer solutions. 2. Design an algorithm that, given `n` (say up to 10,000), returns the number of distinct combinations of coins whose total value is exactly `n`. 3. Analyze the time and space complexity of your algorithm. You do **not** need to print the actual combinations, only their count.

Quick Answer: This two-part question evaluates probabilistic reasoning about expected waiting times with random queue switching and combinatorial/algorithmic counting for coin-change combinations, testing skills in probability, expectation and order statistics as well as combinatorics and dynamic programming within the Coding & Algorithms domain.

Related Interview Questions

  • Optimize trade PnL table updates - Jane Street (hard)
  • Transform sparse time-code stream to dense rows - Jane Street (easy)
  • Sort trade executions into a canonical order - Jane Street (easy)
  • Implement Connect Four with bottom push-up - Jane Street (Medium)
Jane Street logo
Jane Street
Oct 14, 2025, 12:00 AM
Data Scientist
Take-home Project
Coding & Algorithms
14
0

This entry contains two separate interview-style quantitative/algorithmic questions.

1. Queue switching decision problem

You are standing in a single FIFO queue of 100 customers waiting for service at a checkout counter. Customers are served one at a time, and each service takes the same fixed amount of time (say, one time unit). Positions are numbered 1 (front of the line, served next) through 100 (back of the line).

At time 0, a second identical checkout counter opens. Each of the other 99 customers independently decides to move to the new queue with probability 1/2. All those who choose to move (possibly including you) are randomly ordered in the new queue; every ordering of the movers is equally likely. Both checkout counters start serving at the same time and serve at the same rate (one customer per time unit) from their respective queues.

You are currently at position k in the original queue (1 ≤ k ≤ 100). You must decide once at time 0 whether to stay in the original queue or move to the new one.

  1. Derive an expression for your expected waiting time until service if you stay in the original queue as a function of k .
  2. Derive an expression for your expected waiting time until service if you switch to the new queue, taking into account that:
    • Each of the other 99 customers moves independently with probability 1/2.
    • If you move, your position among all movers is uniformly random.
    • Both queues are then served in parallel at the same rate.
  3. For which values of k is it better in expectation (i.e., gives a lower expected waiting time) to switch rather than stay? Give the threshold value(s) of k where your preference changes.

You may assume that everyone else’s decision to move or stay is independent of your own and of their position; you are not required to model strategic behavior.

2. Coin change combinations with US-style denominations

You are given an integer amount n representing a value in cents and you have an unlimited supply of the following coin denominations:

  • 1 cent
  • 5 cents
  • 10 cents
  • 25 cents
  • 100 cents (i.e., 1 dollar)

You want to know in how many distinct combinations (multisets) you can make exactly n cents using these coins. The order of coins does not matter; for example, 1 + 5 is the same combination as 5 + 1.

Task:

  1. Define the problem formally in terms of counting integer solutions.
  2. Design an algorithm that, given n (say up to 10,000), returns the number of distinct combinations of coins whose total value is exactly n .
  3. Analyze the time and space complexity of your algorithm.

You do not need to print the actual combinations, only their count.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Jane Street•More Data Scientist•Jane Street Data Scientist•Jane Street Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.