Compute Sliding Window Averages
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Quick Answer: This question evaluates proficiency in array manipulation, sliding-window techniques, and algorithmic efficiency including time and space complexity. It is commonly asked in technical interviews within the Coding & Algorithms domain to probe practical implementation skills for contiguous-data processing, and the level of abstraction is practical application rather than purely conceptual understanding.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,2,3,4,5], 3)
Expected Output: [2.0, 3.0, 4.0]
Explanation: Three windows have averages 2, 3, and 4.
Input: ([5,5], 3)
Expected Output: []
Explanation: Window larger than the array returns empty.
Input: ([1,-1,1,-1], 2)
Expected Output: [0.0, 0.0, 0.0]
Explanation: Negative values are included normally.
Hints
- Clarify edge cases before coding.
- Keep outputs deterministic when several valid answers exist.