Disk Space Window Analyzer
Reported by candidates from Agoda's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Strip the storage dressing off Agoda's Disk Space Window Analyzer, reported in September 2026, and it's a sliding window minimum problem. Find the min of every window of size k, then take the max of those mins. That's it. With up to 200000 entries, the brute force of scanning each window dies fast, so the OA wants the monotonic deque. If you blank on the deque mechanics mid-assessment, StealthCoder runs invisibly on your desktop as a safety net and hands you the solution while the proctor sees nothing.
The problem
For every contiguous window of windowSize entries, compute the minimum available space. Return the maximum of those window minimums. Function maximizeWindowMinimum(space: int[], windowSize: int) → int Examples Example 1 space = [8,2,4,6] windowSize = 2 return = 4 Case 1 exercises the documented deterministic contract. Example 2 space = [1,2,3] windowSize = 1 return = 3 Case 2 exercises the documented deterministic contract. Example 3 space = [5,4,3] windowSize = 3 return = 3 Case 3 exercises the documented deterministic contract. Constraints 1 <= windowSize <= space.length <= 200000. 0 <= space[i] <= 10^9.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is a monotonic deque of indices. Walk the array. Pop from the back while the new value is less than or equal to the back value, since those can never be a window minimum again. Push the new index. Pop from the front if its index fell out of the window. Once you've seen windowSize elements, the front is your window minimum, so update the running max. That's O(n) time and O(k) space. The common pitfall is the O(n*k) rescan, which times out at 200000. Another is off-by-one on the expiry check: drop the front when index <= i - windowSize. Check example 3, where windowSize equals the length and you get a single window. If the deque logic slips under pressure, StealthCoder is the hedge on the live OA, reading the problem and giving you working code.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Disk Space Window Analyzer 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. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Agoda's OA.
Agoda reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Disk Space Window Analyzer FAQ
What's the trick for Agoda's Disk Space Window Analyzer?+
It's sliding window minimum plus a running max. Use a monotonic deque that keeps indices of increasing values. The front is always the current window's minimum. After each full window, compare it to your best answer and keep the larger one.
How hard is this problem really?+
Medium. The statement is short and the idea is standard. The difficulty is writing the deque correctly without off-by-one errors and avoiding the O(n*k) brute force, which fails with 200000 elements.
Can I solve it without a deque?+
Yes. A sparse table or a segment tree gives range minimums, but both cost more code. Another option is the block prefix/suffix min trick, which is O(n). The deque is shortest and fastest to write, so most candidates pick it.
What edge cases should I test?+
Test windowSize equal to 1, which returns the array maximum. Test windowSize equal to the length, which returns the global minimum. Also test duplicates and zeros, since values can be 0. Example 3, [5,4,3] with k=3, returns 3.
How do I prepare in 48 hours?+
Write the sliding window maximum deque from memory twice, then flip it to minimum. Add the outer max over window minimums. Run the three given examples by hand. That covers the whole pattern, and you don't need much more for this one.