Problem 2104 · Medium

Sum of Subarray Ranges

Sum the difference between maximum and minimum over every contiguous subarray.

Open the interactive visualisation