Quick Overview

This question evaluates combinatorics and probability skills, specifically counting combinations and recognizing arithmetic progression structure among distinct integers, and belongs to the Coding & Algorithms category for Data Scientist roles.

Compute probability of random arithmetic progression triple

Company: Maven Securities

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Online Assessment

You have the integers from 1 to 30 inclusive. You randomly choose 3 **distinct** numbers **without replacement**, and all 3-element subsets are equally likely. The order in which the numbers are drawn does **not** matter. What is the probability that these three numbers can be arranged to form an arithmetic progression (three distinct terms with a common difference)? Express your answer as a simplified fraction or decimal.

Overview: This question evaluates combinatorics and probability skills, specifically counting combinations and recognizing arithmetic progression structure among distinct integers, and belongs to the Coding & Algorithms category for Data Scientist roles.

Read the full Maven Securities Data Scientist interview experience this question came from

Return the simplified probability that three distinct numbers chosen from 1..30 form a three-term arithmetic progression.

Constraints

  • Return the reduced fraction as a string.

Examples

Input: ()

Expected Output: '21/406'

Explanation: There are 210 arithmetic-progression triples among C(30,3)=4060 subsets.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

Loading coding console...