Katkat

Identify Longest Consecutive Incrementing Watch-Time Sequence

NetflixData Scientist · Onsite

Last 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.