You are viewing a single comment's thread. Return to all comments →
public static long arrayManipulation(int n, List> queries) { long max=0; List> arr = new List>();
List<long> ft = Enumerable.Repeat((long)0, n).ToList(); arr.Add(ft); for(int row=0;row<queries.Count;row++) { arr.Add(ft); for(int col=0;col<n;col++) { var a=queries[row][0]-1; var b=queries[row][1]-1; var k=queries[row][2]; if(col>=a && col<=b) { long calc=arr[row][col]+k; arr[row+1][col]=calc; max=calc>max?calc:max; } else{ arr[row+1][col]=arr[row][col]; } } Console.WriteLine(string.Join(" ",arr[row+1])); } return max; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
public static long arrayManipulation(int n, List> queries) { long max=0; List> arr = new List>();
}