FastPrepCount Hotspot Playback Windows
Problems/Count Hotspot Playback Windows

Count Hotspot Playback Windows

Google logoGoogle● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the goal of counting playback windows with non-negative values and a strict threshold. It hints at prefix sums and a sliding window. It has follow-ups for negative values and for streaming. It does not give the exact function signature or the input limits. Our version is about 94% the same as the reported question.

You are given an integer array views, where views[i] is the number of new video playbacks recorded during minute i, and an integer threshold.

Count the nonempty ranges of consecutive minutes whose total playback count is strictly greater than threshold. Return that count.

Playback counts are nonnegative. Return the exact number of qualifying windows as a long value.

Interview extensions

  • Explain how prefix sums answer many inclusive interval-total queries [left, right] over the same playback array.
  • If playback corrections may be negative, explain why the monotone sliding-window argument no longer works and how to count qualifying windows in O(n log n) time.
  • Discuss how to serve a very large volume of online interval queries.
  • For nonnegative playback counts, explain how to process the values as a stream without storing the entire array.

Function

countHotspotWindows(views: int[], threshold: long) → long

Examples

Example 1

views = [2,1,3]threshold = 3return = 2

The qualifying windows are [1,3] with total 4 and [2,1,3] with total 6. Windows totaling exactly 3 do not qualify.

Example 2

views = [0,0]threshold = -1return = 3

All three nonempty windows have total 0, which is strictly greater than -1.

Example 3

views = [5,0,1]threshold = 4return = 3

The three qualifying windows are [5], [5,0], and [5,0,1].

Example 4

views = []threshold = 10return = 0

An empty playback history contains no nonempty time window.

Constraints

  • 0 <= views.length <= 200000
  • 0 <= views[i] <= 10^9
  • -10^18 <= threshold <= 10^18
  • The answer fits in a signed 64-bit integer.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Subarray with a Given SumExpedia · ONSITE INTERVIEWExpedia interview questions
  • Shortest Window with Required CountsOracle · ONSITE INTERVIEWOracle interview questions
  • Longest Binary Window with at Most K OnesLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Trim a Telemetry Buffer to a Target SumAmazon · ONSITE INTERVIEW
  • Trapping Rain WaterInMobi · ONSITE INTERVIEWInMobi interview questions
  • Count Subarrays With Product Equal to KSalesforce · OASalesforce interview questions
  • Subarray Product Less Than KApple · PHONE SCREENApple interview questions
  • Subarray Product Less Than KAngel One · PHONE SCREEN
  • Subarray Product Less Than KThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Trapping Rain WaterGoldman Sachs · PHONE SCREENGoldman Sachs interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public long countHotspotWindows(int[] views, long threshold) {
      // Write your code here.
    }

}
Checking account…