You are viewing a single comment's thread. Return to all comments →
Same Solution in Scala
def arrayManipulation(n: Int, queries: Array[Array[Int]]): Long = {
val arr = Array.ofDim[Long](n + 1) for (q <- queries) { arr(q(0)) = arr(q(0)) + q(2) if (q((1)) + 1 != arr.size) arr(q(1) + 1) = arr(q(1) + 1) - q(2) } for (i <- 1 to arr.length - 1) { arr(i) = arr(i) + arr(i - 1) } arr.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 →
Same Solution in Scala
def arrayManipulation(n: Int, queries: Array[Array[Int]]): Long = {
}