Algorithm · Rubrik · Hard
Cooper and TARS are trapped in the 5th dimension, and the only way to send gravitational data back to Murph is to satisfy a challenge posed by the higher-dimensional beings. They are given an ordered sequence of n rocks, each with an initial mass (m1, m2, m3, ..., mn). They must process a series of operations on this sequence. Two kinds of operations exist: Range Sum Query: Given two indices x and y, compute and output the sum of the masses of all rocks from index x to y…
Checking your access…