Booking.com OA Question 2024 August | Sliding Window | on-campus

Question · Posted Jun 2026

Question: Maximum Average Subarray I Problem Statement You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the maximum average value and return this value. Any answer with a calculation error less than 10-5 will be accepted. Constraints n == nums.length 1 <= k <= n <= 105 -104 <= nums[i] <= 104 Examples Example 1: Input: nums = [1,12,-5,-6,50,3], k = 4 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account