PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Product / Decision Making/Goldman Sachs

Lottery Coupon Winners Calculation

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic counting and combinatorics skills, focusing on frequency analysis of digit-sum distributions and reasoning about time and space complexity.

  • medium
  • Goldman Sachs
  • Product / Decision Making
  • Product Manager

Lottery Coupon Winners Calculation

Company: Goldman Sachs

Role: Product Manager

Category: Product / Decision Making

Difficulty: medium

Interview Round: Take-home Project

##### Question You are given an integer n representing consecutively numbered lottery coupons from 1 to n. A person is considered a winner if the sum of the digits on their coupon equals a value s. Among all possible values of s (1 ≤ s ≤ 9·⌈log10 n⌉), determine how many distinct values of s yield the largest possible number of winners. Implement a function lotteryCoupons(n) that returns this count, and explain your algorithm’s time- and space-complexity. ​ ##### Hints Observe that only the frequency of each digit-sum matters; you do not need to materialize every coupon number. Think about how to compute digit sums efficiently for the range 1…n.

Quick Answer: This question evaluates algorithmic counting and combinatorics skills, focusing on frequency analysis of digit-sum distributions and reasoning about time and space complexity.

Related Interview Questions

  • Word Compression Algorithm - Goldman Sachs (medium)
Goldman Sachs logo
Goldman Sachs
Jul 4, 2025, 8:28 PM
Product Manager
Take-home Project
Product / Decision Making
13
0

Lottery Coupons: Most Popular Digit-Sum Values

Problem

You have consecutively numbered lottery coupons from 1 to n (inclusive). A coupon is a winner if the sum of its digits equals some value s.

Among all valid digit sums s in the range 1 to 9·d, where d is the number of digits of n, determine how many distinct s values produce the maximum number of winners (i.e., the most frequent digit-sum(s) among coupons 1…n).

Implement a function lotteryCoupons(n) that returns this count, and explain the algorithm’s time and space complexity.

  • Assume n ≥ 1 and base-10 representation.
  • Note: Values of s that are not achievable for 1…n simply have zero winners and do not affect the maximum.

Hints

  • Only the frequency of each digit-sum matters; you do not need to materialize each coupon.
  • Think about how to compute digit-sum frequencies efficiently for the range 1…n.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Product / Decision Making•More Goldman Sachs•More Product Manager•Goldman Sachs Product Manager•Goldman Sachs Product / Decision Making•Product Manager Product / Decision Making
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.