As reported: Booking.com SE-2 / SDE 2 (Bangalore), 2025–2026, the DSA / coding round (one hour): a variation of Sliding Window Maximum wrapped in a story with formatted inputs — not stated as the plain problem, so recognising it is part of the task. Solving it optimally with the edge cases covered was the bar.
This is LeetCode 239 — Sliding Window Maximum. Our write-up: /sliding-window-maximum.
You are given an integer array nums and a window size k. A window of size k slides from the very left of the array to the very right, moving one position at a time. Return the maximum value of each window, from left to right.
Example 1
nums = [1,3,-1,-3,5,3,6,7], k = 3
Output: [3,3,5,5,6,7]
Example 2
nums = [1], k = 1
Output: [1]
Constraints: 1 <= nums.length <= 10^5, -10^4 <= nums[i] <= 10^4, 1 <= k <= nums.length.
Code runner format: one JSON value per line: nums, k. Implement maxSlidingWindow(nums, k) returning the list of window maximums.