Search⌘ K
AI Features

Range Sum Query - Immutable

Explore how to create a NumArray class in JavaScript that efficiently calculates the sum of elements within a given range of indices. Learn to handle multiple sumRange queries by designing a custom data structure that supports quick access, improving performance in coding interviews.

Statement

You are given an integer array, nums, and you need to handle multiple queries of the following type: ...