Search
⌘K

Leetcode 303. Range Sum Query - Immutable

Given an immutable integer array, implement a NumArray that returns the sum of elements in any [left, right] range. Because the array is static and queries may be numerous, precompute prefix sums so each query can be answered in O(1) time.


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.