Longest Stable Window of Modem Signal Strength Samples
Last updated: November 29, 2026
Quick Overview
Given a stream of received signal strength samples (dBm) and a tolerance T, find the longest contiguous window where the maximum minus minimum sample is at most T. Return the start and end indices of that window.
Qualcomm
November 29, 20260
0
0 solved
Given a stream of received signal strength samples (dBm) and a tolerance T, find the longest contiguous window where the maximum minus minimum sample is at most T. Return the start and end indices of that window.
This mirrors work on Qualcomm's Snapdragon modem stack, where a baseband algorithm decides whether a channel is stable enough to keep a beam or trigger a handover. The interviewer wants a linear-time sliding window and expects you to see that a single running max is not enough once the left edge moves.
What the Interviewer Expects
- Recognizes the sliding window with a shrinking left edge
- Uses two monotonic deques to track the window max and min in amortized O(1)
- Explains why indices, not values, are stored in the deques
- Achieves O(n) time and justifies the amortized bound
- Handles empty input and ties deterministically (first longest window)
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
- How would you adapt this to an unbounded stream where you must report the stable window ending at each new sample?
- If memory on the DSP is capped at W samples, how does the answer change?
- What if the tolerance is relative (percent of mean) instead of absolute?
- Could you use a sorted container instead of deques, and what does it cost?
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 integer or float samples, tolerance
T >= 0. - Output:
(start, end)inclusive for the longest window withmax - min <= T; earliest one on ties;Nonefor empty input. - Should r...
High-Level Design
Grow the window one sample at a time on the right. Maintain a decreasing deque of indices for the max and an increasing deque for the min. When max - min exceeds T, advance left and drop deque h...