Prototype: implement prototype(long[] values, List<Range> queries) returning List<Long> with a direct baseline.
Final: implement solve(long[] values, List<Range> queries) with the mechanism and bounds described above. Return sums for [left,right) in query order. Negative values and empty ranges are valid; empty sums are zero. Reject any range unless 0 <= left <= right <= values.length, preserving both inputs even when a later query is invalid. Both stages have the same observable contract. The prototype may use the simpler method; final must use the target data structure.
The supplied nested record types define the API. All methods are static members of Exercise.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.