Transcript Window Metrics
Reported by candidates from Sesame's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Sesame's Transcript Window Metrics showed up in candidate reports in July 2026, and the trap is sneaky. Brute force looks fine on the three examples, then dies when the array hits 100000 events. It's a sliding window problem with two jobs per step: track the max length and the distinct user count. If you've got the OA in a day or two, this is the shape to recognize. And if you blank on the max part, StealthCoder runs invisibly during the live assessment as a safety net, so one missed idea doesn't sink you.
The problem
Transcript events arrive in order. Event i has user userIds[i] and transcript length lengths[i]. For every contiguous window of exactly windowSize events, return one row [maximumTranscriptLength, distinctUserCount]. Rows must follow window order. Function transcriptWindowMetrics(userIds: String[], lengths: int[], windowSize: int) → int[][] Examples Example 1 userIds = ["a","b","a","c"] lengths = [4,7,5,9] windowSize = 3 return = [[7,2],[9,3]] The first window has users a and b; the second has a, b, and c. Example 2 userIds = ["u","u","v"] lengths = [2,8,1] windowSize = 2 return = [[8,1],[8,2]] The maximum stays 8 while the distinct-user count changes. Example 3 userIds = ["x","y"] lengths = [0,3] windowSize = 1 return = [[0,1],[3,1]] A one-event window always has one distinct user. Constraints 1 <= windowSize <= userIds.length == lengths.length <= 100000. 0 <= lengths[i] <= 1000000000. User IDs are nonempty strings.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The edge case that breaks the naive solution is size. Rescanning every window costs O(n * windowSize), which is up to 10^10 operations. Split the work. For distinct users, keep a hash map of counts. Add the incoming user, decrement the outgoing one, and delete the key when its count hits zero. Map size is your answer. For the max, use a monotonic deque of indices with decreasing lengths. Pop from the back while the new value is bigger, pop from the front when the index leaves the window. Front is the max. Common pitfall: forgetting to delete zero-count keys, which inflates the distinct count. Also don't use a plain running max, because it can't shrink when the big value exits. Lengths go to 10^9, so int is fine, but keep the output as an int[][]. StealthCoder is your hedge if the deque logic slips live. Total time is O(n).
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Transcript Window Metrics cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderYou've seen the question.
Make sure you actually pass Sesame's OA.
Sesame reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Transcript Window Metrics FAQ
What's the trick in Transcript Window Metrics?+
Treat it as two sliding window problems at once. A hash map of counts gives distinct users in O(1) per step. A monotonic deque gives the window max in amortized O(1). Together you get O(n) instead of rescanning each window.
How hard is this one really?+
Medium. The window idea is easy to spot. The part that trips people is the max, since a running max can't drop when the biggest event leaves. If you know the sliding window maximum deque, the rest is bookkeeping.
Can I use a heap for the max instead of a deque?+
Yes, with lazy deletion. Push (length, index) and pop the top while its index is outside the window. It's O(n log n), which passes at 100000. The deque is cleaner and faster, but the heap works if it's what you remember.
What edge cases should I test before submitting?+
windowSize of 1 (every row has one distinct user), windowSize equal to the array length (a single row), repeated users that leave and re-enter, and lengths of 0. Also confirm you remove map keys when a count reaches zero.
How do I prepare for this in 48 hours?+
Write sliding window maximum from scratch with a deque, then add a count map for distinct elements. Do it once cold without notes. Those two pieces are all this problem needs, and Sesame's July 2026 report suggests it's current.