• + 0 comments

    public static long arrayManipulation(int n, List> queries) { long[] arr = new long[n]; long sum = 0; long max = 0;

        for(int i=0; i < queries.Count; i++)
        {
            int a = queries[i][0] - 1;
            int b = queries[i][1] - 1;
            int k = queries[i][2];
    
            for(int col=a;col<=b;col++)
            {
                arr[col] += k;
                max = Math.Max(max,arr[col]);
            }
        }
    
        return max;
    }