Shortest Telemetry Burst Whose Net Byte Delta Reaches a Threshold
Last updated: November 29, 2026
Quick Overview
A network telemetry stream records signed byte deltas per interval (positive for growth, negative for drain). Return the length of the shortest contiguous run whose sum is at least `threshold`, or -1 if none exists.
Microsoft
November 29, 20260
0
0 solved
A network telemetry stream records signed byte deltas per interval (positive for growth, negative for drain). Return the length of the shortest contiguous run whose sum is at least `threshold`, or -1 if none exists.
Microsoft onsite rounds use this to see whether candidates notice that negative values break the usual two pointer window. The interviewer expects prefix sums plus a monotonic deque and a clear argument for both pop rules.
What the Interviewer Expects
- Explain why the sliding window fails when values can be negative
- Convert to prefix sums: find j > i with P[j] - P[i] >= threshold and smallest j - i
- Maintain a deque of start indices with increasing prefix values
- Justify popping from the front (answer found, can never be shorter) and from the back (dominated start)
- Reach O(n)
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
- What if you want the count of such runs instead of the shortest?
- How would you handle a stream where you only keep the last W intervals?
- What if all values are known to be positive?
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: list of integers (may be negative) and a threshold.
- Output: smallest length of a contiguous subarray with sum at least threshold, or -1.
- Clarify that the threshold is positive in typical ...
High-Level Design
Let P[k] be the sum of the first k deltas. A run from i to j - 1 qualifies when P[j] - P[i] >= threshold. For each end j we want the latest start i that still qualifies.
Keep a deque of candidate...