Range Sum Query Immutable Leetcode Javascript Interview