Longest Telemetry Session Without a Repeated Event Type
Last updated: November 29, 2026
Quick Overview
Given a sequence of telemetry event types from one user session, find the longest contiguous stretch in which no event type appears twice, returning its length and starting index.
Microsoft
November 29, 20260
0
0 solved
Given a sequence of telemetry event types from one user session, find the longest contiguous stretch in which no event type appears twice, returning its length and starting index.
Office and Windows telemetry pipelines slice sessions into segments, and this question is a sliding window problem in that setting. Microsoft interviewers check that you move the left edge correctly (only forward) and that you can say why the algorithm is linear.
What the Interviewer Expects
- Uses a variable-size sliding window with a last-seen index map
- Moves the window start only forward, avoiding the abba bug
- Returns both the length and where the window starts
- Explains the O(n) bound from each index entering and leaving once
- Tests with duplicates at the edges and empty input
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Allow each event type at most twice in the window.
- Find the longest window with at most k distinct event types.
- Events arrive as an unbounded stream: what can you report in bounded memory?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input is a list of hashable event types. Output (length, start) for the longest window with all distinct types; on ties, the earliest. Empty input gives (0, 0)....
High-Level Design
Maintain a window [start, i] that always has unique types. When the new event already appears inside the window, the window must start just after that earlier occurrence. Storing each type's last in...