Identify Longest Consecutive Incrementing Watch-Time Sequence
NetflixData Scientist · OnsiteLast updated
This question evaluates a candidate's ability to design and analyze efficient algorithms for detecting longest consecutive incrementing sequences in unsorted integer arrays, testing understanding of appropriate data structures and time/space complexity trade-offs.
Scenario
A streaming platform records daily minutes watched per user and wants to identify engagement streaks.
Question
Given an unsorted integer array representing daily watch-time deltas, return the length of the longest sequence of consecutive, incrementing integers (e.g., 1,2,3…). Explain the algorithm and analyze complexity.
Hints
Think hash-set to achieve O(n) time and avoid re-scanning sequences.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.