Poisson Probability of Page Errors
Updated
Problem statement
You observed totalErrors errors across pages pages. For this exercise, use a Poisson model for a page's error count with mean lambda = totalErrors / pages. Return the probability that a page has exactly k errors.
Under this model, the probability is exp(-lambda) * lambda^k / k!. When lambda is 0, the probability is 1 for k=0 and 0 otherwise. Return a floating-point result without fixed decimal rounding.
The observed total estimates the Poisson mean; this exercise does not condition a fixed set of errors to be allocated among the pages.
Function
pageErrorProbability(totalErrors: int, pages: int, k: int) → doubleExamples
Example 1
totalErrors = 10pages = 5k = 2return = 0.2706705664732254The mean is 10/5 = 2. The probability of two errors is exp(-2)*2^2/2! = 2*exp(-2), approximately 0.2706705665.
Example 2
totalErrors = 0pages = 3k = 0return = 1.0The estimated mean is 0. A zero-rate Poisson count is zero with probability 1.
Constraints
- For this exercise, assume
0 <= totalErrors <= 100. 1 <= pages <= 1000and0 <= k <= 1000.- Return a finite value between 0 and 1, accepted within absolute or relative error
10^-6.
More JP Morgan Chase Onsite Interview questions
- LFU CacheONSITE INTERVIEW · Seen Nov 2026
- LRU CacheONSITE INTERVIEW · Seen Nov 2026
- Employees Above Average SalaryONSITE INTERVIEW · Seen Sep 2026
- Highest-Earning Employees By DepartmentONSITE INTERVIEW · Seen Sep 2026
- K Largest Integers in Descending OrderONSITE INTERVIEW · Seen Aug 2026
- Tile a Three-Row Board with DominoesONSITE INTERVIEW · Seen Jan 2026
- Two SumONSITE INTERVIEW · Seen Nov 2025
- Intersection of Two ListsONSITE INTERVIEW · Seen Jan 2025
- Maximum Subarray SumONSITE INTERVIEW · Seen Jan 2025
- Fibonacci NumberONSITE INTERVIEW · Seen Nov 2024
Similar questions at other companies
- Plus OneDruva · ONSITE INTERVIEW
- Rotate a Flat Image ClockwiseGoogle · ONSITE INTERVIEWGoogle interview questions
- Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
- Maximum Product of Three IntegersPelatro · ONSITE INTERVIEW
- Climbing StairsAmazon · ONSITE INTERVIEW
- Maximum 69 NumberHSBC · ONSITE INTERVIEWHSBC interview questions
- Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Exact-Sixty Dice Game ValueJane Street · ONSITE INTERVIEWJane Street interview questions
- Find the Missing Number from 1 to nHyperVerge · ONSITE INTERVIEW
- Alternating Index Square SumAccenture · ONSITE INTERVIEWAccenture interview questions
Interview reports that mention this question
JP Morgan Chase interview experiences
- JPMorgan Quant Stats Superdays: 3 Experiences (Part 3 of 3)
- JPMorgan Quant Modeling Superdays: 7 Experiences (Part 2 of 3)
- JP Morgan Chase Data and AI Intern Superday: 11 Experiences
- JPMorgan Code for Good India 2024: 6 Experiences (Part 5 of 5)
- JPMorgan Code for Good India: 10 Experiences (Part 4 of 5)