Answer: Booking.com OA Question 2024 August | Sliding Window | on-campus
Answer · Posted Jun 2026
Solution: Maximum Average Subarray I — Fixed Size Sliding Window Approach Since the subarray length is fixed at k, we use a Fixed-Size Sliding Window. Instead of recomputing the sum from scratch for each window, we efficiently slide the window by: Computing the sum of the first k elements as our initial window. For each subsequent position, add the new right element and subtract the outgoing left element to get the next window's sum in O(1). Track the maximum window ...
The full answer & interview discussion are available to premium members.
Log in Create a free account