PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Upstart

Implement decay simulation and trailing-zero counting

Last updated: Mar 29, 2026

Quick Overview

This Coding & Algorithms question for a Data Scientist role evaluates stochastic simulation and probability modeling for radioactive decay alongside combinatorics and number-theoretic reasoning for factorial trailing-zero computation, requiring implementation-level algorithmic thinking in Python.

  • medium
  • Upstart
  • Coding & Algorithms
  • Data Scientist

Implement decay simulation and trailing-zero counting

Company: Upstart

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement the following in Python: 1) **Radioactive decay simulation:** Half-life is 1 day. Write a simulation function that takes: - input: integer **m** (number of days), integer **n** (number of atoms) - process: simulate independent decay over time (you may model survival each day with probability 0.5, or equivalently sample each atom’s decay time) - output: the final **state** of each particle (e.g., a boolean list/array of length n indicating survived/decayed after m days) and/or the number of survivors. Also discuss runtime and how you would validate correctness against the analytic Binomial(n, 0.5^m) result. 2) **Factorial and trailing zeros:** - (a) Implement a factorial function in Python (mention multiple approaches). - (b) Given an integer **n**, compute the number of trailing zeros in **n!** efficiently (better than computing n! explicitly).

Quick Answer: This Coding & Algorithms question for a Data Scientist role evaluates stochastic simulation and probability modeling for radioactive decay alongside combinatorics and number-theoretic reasoning for factorial trailing-zero computation, requiring implementation-level algorithmic thinking in Python.

Related Interview Questions

  • Implement Three Assessment Functions - Upstart (medium)
  • Solve Five OA Coding Tasks - Upstart (medium)
  • Solve Reported OA Coding Problems - Upstart (medium)
  • Decrypt a twice-encrypted message using known pairs - Upstart (medium)
  • Compute buffet revenue with capacity and waiting - Upstart (medium)
Upstart logo
Upstart
Nov 29, 2025, 12:00 AM
Data Scientist
Onsite
Coding & Algorithms
5
0

Implement the following in Python:

  1. Radioactive decay simulation: Half-life is 1 day. Write a simulation function that takes:
    • input: integer m (number of days), integer n (number of atoms)
    • process: simulate independent decay over time (you may model survival each day with probability 0.5, or equivalently sample each atom’s decay time)
    • output: the final state of each particle (e.g., a boolean list/array of length n indicating survived/decayed after m days) and/or the number of survivors. Also discuss runtime and how you would validate correctness against the analytic Binomial(n, 0.5^m) result.
  2. Factorial and trailing zeros:
    • (a) Implement a factorial function in Python (mention multiple approaches).
    • (b) Given an integer n , compute the number of trailing zeros in n! efficiently (better than computing n! explicitly).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Upstart•More Data Scientist•Upstart Data Scientist•Upstart 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
  • Careers
  • 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.