hackerrank/interview_preparation_kit_arrays.rb
# Complete the arrayManipulation function below.

Complete the arrayManipulation function below.
Complete the arrayManipulation function below .
def arrayManipulation(n, queries)
  arr = Array.new(n, 0)
  queries.each do |query|
    left = query[0] - 1
    right = query[1] - 1
    summand = query[2]
    arr[(left..right)] = arr[(left..right)].map { |a| a + summand }
  end
  arr.max
end
def arrayManipulation ( n , queries ) arr = Array . new ( n , 0 ) queries . each do | query | left = query [ 0 ] - 1 right = query [ 1 ] - 1 summand = query [ 2 ] arr [ ( left .. right ) ] = arr [ ( left .. right ) ] . map { | a | a + summand } end arr . max end
Complete the arrayManipulation function below.
Complete the arrayManipulation function below .
n
<not_specific>
queries
<not_specific>