package com.fishercoder.solutions;

public class _370 {
    public static class Solution1 {
        public int[] getModifiedArray(int length, int[][] updates) {
            int[] nums = new int[length];
            int k = updates.length;
            for (int i = 0; i < k; i++) {
                int start = updates[i][0];
                int end = updates[i][1];
                int inc = updates[i][2];
                nums[start] += inc;
                if (end < length - 1) {
                    nums[end + 1] -= inc;
                }
            }

            int sum = 0;
            for (int i = 0; i < length; i++) {
                sum += nums[i];
                nums[i] = sum;
            }
            return nums;
        }
    }
}

@@ -739,11 +739,386 @@
  %7D%0A    %7D
+%0A%0A    public static class Solution2 %7B%0A        public int%5B%5D getModifiedArray(int length, int%5B%5D%5B%5D updates) %7B%0A            int%5B%5D result = new int%5Blength%5D;%0A            for (int%5B%5D update : updates) %7B%0A                for (int i = update%5B0%5D; i %3C= update%5B1%5D; i++) %7B%0A                    result%5Bi%5D += update%5B2%5D;%0A                %7D%0A            %7D%0A            return result;%0A        %7D%0A    %7D
 %0A%7D%0A

add a solution for 370