We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My js solution ran out of time for a few test cases
function arrayManipulation(n, queries) {
let a = new Array(n).fill(0);
for(let j = 0; j < queries.length; j++) {
let temp = queries[j]
let k = temp[0];
while(k <= temp[1]) {
a[k-1] += temp[2];
k++;
}
}
return Math.max.apply(Math, a);
}
Cookie support is required to access HackerRank
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 →
My js solution ran out of time for a few test cases
function arrayManipulation(n, queries) { let a = new Array(n).fill(0); for(let j = 0; j < queries.length; j++) { let temp = queries[j] let k = temp[0]; while(k <= temp[1]) { a[k-1] += temp[2]; k++; }
} return Math.max.apply(Math, a); }