PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of probability concepts including a continuous uniform waiting-time model for bus arrivals and discrete outcome counting for the sum of two dice, testing probabilistic reasoning, uniform distributions, and basic combinatorics.

  • medium
  • Sig
  • Coding & Algorithms
  • Data Scientist

Compute bus-on-time and dice-sum probabilities

Company: Sig

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: HR Screen

You are asked two basic probability questions. ## A) Catching a bus to arrive before a movie A person is going to the cinema. The movie starts in **L** minutes. - Buses depart the stop exactly every **I** minutes at times: \(0, I, 2I, \dots\). - The bus ride time from the stop to the cinema is a constant **R** minutes. - The person arrives at the bus stop at a random time that is uniformly distributed over one bus interval, i.e. \(T \sim \text{Uniform}(0, I)\), where \(T\) is the time since the last bus departed. The waiting time is therefore \(W = I - T\) (with \(W \in (0, I]\)). **Task:** Derive \(\Pr[W + R \le L]\), i.e. the probability the person arrives at the cinema before the movie starts, as a function of \(I, R, L\). (Optionally: evaluate it for a concrete example such as \(I=10\), \(R=25\), \(L=40\).) ## B) Sum of two dice Two fair six-sided dice are rolled. **Task:** For an integer \(S\) in \([2,12]\), compute \(\Pr[d_1 + d_2 = S]\). Clarify how the probability changes with \(S\) (e.g., give a formula or a small table).

Quick Answer: This question evaluates understanding of probability concepts including a continuous uniform waiting-time model for bus arrivals and discrete outcome counting for the sum of two dice, testing probabilistic reasoning, uniform distributions, and basic combinatorics.

Part 1: Bus Arrival Before the Movie

A person arrives at a bus stop at a uniformly random time within one bus interval. Buses depart every I minutes, and the ride to the cinema takes R minutes. The movie starts in L minutes. Compute the exact probability that the person reaches the cinema on or before the movie starts. Return the probability as a reduced fraction string. If the probability is exactly 0 or 1, return "0" or "1".

Constraints

  • 1 <= I <= 10^9
  • 0 <= R <= 10^9
  • 0 <= L <= 10^9
  • All inputs are integers

Examples

Input: (10, 25, 30)

Expected Output: "1/2"

Explanation: The person must have W <= 5. Since W is uniform over a 10-minute interval, the probability is 5/10 = 1/2.

Input: (10, 25, 25)

Expected Output: "0"

Explanation: The person would need W <= 0, but waiting time is always positive, so the probability is 0.

Input: (10, 25, 40)

Expected Output: "1"

Explanation: The person can wait as long as 15 minutes, but the maximum wait is only 10 minutes, so they are always on time.

Input: (10, 25, 28)

Expected Output: "3/10"

Explanation: The person must have W <= 3, so the probability is 3/10.

Input: (7, 3, 10)

Expected Output: "1"

Explanation: The allowed wait is exactly 7 minutes, which matches the entire bus interval, so every arrival works.

Hints

  1. Let W be the waiting time for the next bus. The person is on time exactly when W + R <= L.
  2. Because arrival is uniform within one interval, W is uniform over one full bus interval. The answer is a clamped fraction based on how much waiting time is allowed.

Part 2: Probability of a Two-Dice Sum

Two fair six-sided dice are rolled. Given an integer S, compute the exact probability that the sum of the two dice is exactly S. Return the answer as a reduced fraction string.

Constraints

  • 2 <= S <= 12
  • The dice are standard fair six-sided dice with faces 1 through 6

Examples

Input: (2,)

Expected Output: "1/36"

Explanation: Only (1, 1) gives a sum of 2.

Input: (7,)

Expected Output: "1/6"

Explanation: There are 6 outcomes that sum to 7: (1,6), (2,5), (3,4), (4,3), (5,2), (6,1). So the probability is 6/36 = 1/6.

Input: (12,)

Expected Output: "1/36"

Explanation: Only (6, 6) gives a sum of 12.

Input: (9,)

Expected Output: "1/9"

Explanation: There are 4 outcomes that sum to 9, so the probability is 4/36 = 1/9.

Input: (6,)

Expected Output: "5/36"

Explanation: There are 5 outcomes that sum to 6: (1,5), (2,4), (3,3), (4,2), (5,1).

Hints

  1. Count ordered pairs (d1, d2) out of the 36 equally likely outcomes.
  2. The number of ways grows from sum 2 up to sum 7, then decreases symmetrically.
Last updated: May 31, 2026

Related Coding Questions

  • Solve theatre seating and ticker extraction - Sig (medium)

Loading coding console...

PracHub

Master your tech interviews with 8,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.