Search
⌘K

Leetcode 2015. Average Height of Buildings in Each Segment

Given an array of building heights and a set of contiguous segments (or a fixed window size), compute the average height for each segment; optimize across many queries using prefix sums or a sliding-window to achieve O(n) preprocessing and O(1) per-range answers.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.