Tap here to switch tabs
Problem
Submissions

Problem: Sum of Subarray Minimums

Sum of Subarray Minimums asks you to examine every contiguous subarray of an integer array and return the total of their minimum values modulo a large prime.

Statement

Given an integer array arr, compute the sum of the minimum values across every contiguous subarray of arr. Since the result may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq arr.length ≤3×104\leq 3 \times 10^4

  • 1≤1 \leq arr[i] ≤3×104\leq 3 \times 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Subarray Minimums

Sum of Subarray Minimums asks you to examine every contiguous subarray of an integer array and return the total of their minimum values modulo a large prime.

Statement

Given an integer array arr, compute the sum of the minimum values across every contiguous subarray of arr. Since the result may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq arr.length ≤3×104\leq 3 \times 10^4

  • 1≤1 \leq arr[i] ≤3×104\leq 3 \times 10^4