@@ -0,0 +1,928 @@
+/**%0A * Given an integer array nums, find the sum of the elements between indices i and j (i %E2%89%A4 j), inclusive.%0A *%0A * Example:%0A *%0A * Given nums = %5B-2, 0, 3, -5, 2, -1%5D%0A *%0A * sumRange(0, 2) -%3E 1%0A *%0A * sumRange(2, 5) -%3E -1%0A *%0A * sumRange(0, 5) -%3E -3%0A *%0A * Note:%0A *%0A * You may assume that the array does not change.%0A *%0A * There are many calls to sumRange function.%0A *%0A * Tags: Dynamic Programming%0A *%0A * Similar Problems: (M) Range Sum Query 2D - Immutable, (M) Range Sum Query - Mutable, (E) Maximum Size Subarray Sum%0A * Equals k%0A */%0Apublic class RangeSumQueryImmutable %7B%0A%0A    class NumArray %7B%0A%0A        private int%5B%5D nums;%0A%0A        public NumArray(int%5B%5D nums) %7B%0A            for (int i = 1; i %3C nums.length; i++) %7B%0A                nums%5Bi%5D += nums%5Bi - 1%5D;%0A            %7D%0A            this.nums = nums;%0A        %7D%0A%0A        public int sumRange(int i, int j) %7B%0A            return i == 0 ? nums%5Bj%5D : nums%5Bj%5D - nums%5Bi - 1%5D;%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

add 303 Range Sum Query Immutable