Identify Longest Consecutive Incrementing Watch-Time Sequence
Company: Netflix
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: 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.
Constraints
- 0 <= len(deltas) <= 200000
- -10^9 <= deltas[i] <= 10^9
- Duplicates may appear and should be treated as a single value for sequence building
- Expected average time: O(n) using hashing
- Auxiliary space: O(n)
Hints
- Insert all numbers into a hash set for O(1) average lookups.
- Only start counting from numbers x where x-1 is not in the set (start of a run).
- From each start, incrementally check x+1, x+2, ... to count the run length.
- Duplicates are naturally handled by the set and do not extend runs.