Count Contiguous Windows Where Server Load Strictly Rises
Last updated: November 29, 2026
Quick Overview
Given per-minute CPU load samples from a Borg cell, count the contiguous windows of length at least one in which load strictly increases from each minute to the next.
0
0
0 solved
Given per-minute CPU load samples from a Borg cell, count the contiguous windows of length at least one in which load strictly increases from each minute to the next.
An online-assessment style counting question built on monitoring data. The grader expects an O(n) solution that counts windows by where they end, which is a one-variable DP, rather than enumerating all O(n^2) windows.
What the Interviewer Expects
- Count windows grouped by their ending index
- Define run[i] as the number of rising windows ending at i
- Reset when the strict increase breaks
- Sum run values for the answer
- Handle equal neighbors as breaks
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
- Count windows that are strictly rising of length at least k.
- Allow at most one dip inside a window.
- Return the longest rising window and where it starts.
- Samples arrive as a stream. Report the running count after each sample.
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 load of numbers. A window load[l..r] qualifies if load[i] < load[i+1] for every l <= i < r; single elements always qualify. Output the total number of qualifying windows. Equal conse...
High-Level Design
Group windows by their right end r. If the longest rising run ending at r has length run[r], then exactly run[r] qualifying windows end at r (one for each start inside that run). The run extends w...