SHARE
TWEET

Untitled

a guest Feb 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static long arrayManipulation(int n, int[][] queries) {
  2.         long[] array = new long[n];
  3.         long maxElement = -2147483648;
  4.         foreach (int[] query in queries) {
  5.             for (int i=query[0]; i<=query[1]; i++) {
  6.                     array[i-1] += query[2];
  7.             }
  8.         }
  9.         foreach (long element in array) {
  10.             if (element > maxElement) {
  11.                 maxElement = element;
  12.             }
  13.         }
  14.         return maxElement;
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top