Last active
August 18, 2018 14:40
-
-
Save ytnk531/007e8aca909a758207c67f7e86911acd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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