Did a phone screen yesterday for SWE, Product role (E4-E5) for Canada location. Got asked the following questions:
-
Sliding Window Average: Given an integer array as input and a window size, find the sliding window average.
Input: nums = [1, 2, 3, 4, 5, 6, 7, 8, 9], windowSize = 7
Output: [4.0, 5.0, 6.0]
Follow up: Design an API to return the sliding average, if input is given as a stream instead. Moving Average from Data Stream
Verdict: Passed. Will be scheduling the full loops.
Comments (6)


