Earliest Episode Meeting a Completion Threshold
Updated
Problem statement
Given completionCounts, where completionCounts[s][e] is the number of users who finished episode e + 1 of series s, return the number of the earliest qualifying episode in each series. Each row is one series of ten episodes. Counts in a row never go up, because a user must finish an earlier episode before finishing a later one.
Episode n qualifies when at least 70% of the users who finish episode n also finish episode 10. An episode with zero finishers does not qualify. If no episode in a series qualifies, return -1 for that series.
Check the ratio exactly, using integers only: 10 * completionCounts[s][9] >= 7 * completionCounts[s][n - 1].
Function
earliestRetentionEpisodes(completionCounts: int[][]) → int[]Examples
Example 1
completionCounts = [[100,95,90,85,80,75,70,70,70,70],[100,100,90,80,70,60,50,40,30,20],[100,0,0,0,0,0,0,0,0,0],[50,50,50,50,50,50,50,50,50,50]]return = [1,10,-1,1]The first and fourth series qualify at episode 1. The second series first qualifies at episode 10. In the third, nobody finishes the series, so no episode qualifies.
Example 2
completionCounts = [[100,90,80,70,60,50,40,35,35,35]]return = [6]Episode 6 has 50 finishers, and 35 of them finish the series, exactly 70%. Earlier episodes have more finishers, so a smaller share of them finish the series.
Constraints
1 <= completionCounts.length <= 100000.- Every row has exactly
10values. 0 <= completionCounts[s][e] <= 1000000000.- Each row is nonincreasing.
- Use 64-bit arithmetic for the ratio comparison.
More Bloomberg LP Onsite Interview questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Ring Buffer OperationsAmazon · ONSITE INTERVIEW
- Count Distinct Underwriting PII ValuesAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
- Bounded Word Guess SolverAtlassian · ONSITE INTERVIEWAtlassian interview questions
- Generate an Unbiased Bit from a Biased CoinGoogle · ONSITE INTERVIEWGoogle interview questions
- Apply Overridden Integer TransformsOptimus Information · ONSITE INTERVIEWOptimus Information interview questions
- Copy File Bytes with Partial WritesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Policy Violation Set ChecksPinterest · ONSITE INTERVIEWPinterest interview questions
- Retry with an Attempt LimitOracle · ONSITE INTERVIEWOracle interview questions
- Extract Error Log ContextFlexTrade · ONSITE INTERVIEWFlexTrade interview questions
- Moving Cost by Volume and CategoryWayfair · ONSITE INTERVIEWWayfair interview questions
Interview reports that mention this question
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)