Furthest Episode Meeting a Completion Threshold
Updated
Problem statement
viewerCounts[i] is the recorded viewer count for episode i + 1. The final entry is used only as the number of people who finished the complete series; it is not a candidate episode.
Let threshold = ceil(70% * viewerCounts[n - 1]). Return the largest 1-based index among episodes 1..n-1 whose count is at least threshold. Return -1 if no earlier episode qualifies.
Function
furthestEpisodeAtCompletionThreshold(viewerCounts: int[]) → intExamples
Example 1
viewerCounts = [40,20,6,5,4,6,7,4,3,10]return = 7The final count is 10, so the threshold is 7. Episode 7 is the largest earlier index whose count reaches 7.
Constraints
2 <= viewerCounts.length <= 100000.0 <= viewerCounts[i] <= 10^9.- The final count is positive.
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
- Maximum Profit with Exactly One Stock TransactionRetool · PHONE SCREEN · ONSITE INTERVIEWRetool interview questions
- Best Time to Buy and Sell Stock IIGroww · ONSITE INTERVIEW
- Maximize Two Endpoint ValuesGoogle · ONSITE INTERVIEWGoogle interview questions
- Best Time to Buy and Sell StockOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
- Cheapest Round TripUber · ONSITE INTERVIEWUber interview questions
- Best Time to Buy and Sell StockZoox · ONSITE INTERVIEW
- Evaluate a Blackjack HandGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Best Time to Buy and Sell StockMotive · ONSITE INTERVIEWMotive interview questions
- Maximum Profit with Repeated Stock TradesPalantir · ONSITE INTERVIEWPalantir interview questions
- Pair Coders by RatingExpedia · ONSITE INTERVIEWExpedia interview questions