package leetcode;

/**
 * https://leetcode.com/problems/sum-of-subarray-minimums/
 */
public class Problem907 {
    public int sumSubarrayMins(int[] A) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem907 prob = new Problem907();
        System.out.println(prob.sumSubarrayMins(new int[]{3, 1, 2, 4})); // 17
    }
}

@@ -159,32 +159,340 @@
     
-// TODO%0A        return 0
+long answer = 0;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            int min = Integer.MAX_VALUE;%0A            for (int j = i; j %3C A.length; j++) %7B%0A                min = Math.min(min, A%5Bj%5D);%0A                answer += min;%0A                answer %25= 1000_000_007;%0A            %7D%0A        %7D%0A        return (int) answer %25 1000_000_007
 ;%0A  
@@ -664,16 +664,103 @@
 ; // 17%0A
+        System.out.println(prob.sumSubarrayMins(new int%5B%5D%7B3, 1, 2, 4, 10, 23%7D)); // 76%0A
     %7D%0A%7D%0A

Update problem 907