Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.Arrays;
public class ArrayManupilation {
static long arrayManipulation(int n, int[][] queries) {
long[] arr = new long[n+1];
for (int[] query : queries) {
for(int i = query[0];i <= query[1]; i++) {
arr[i] += query[2];
}
}
return Arrays.stream(arr).max().getAsLong();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.