Java 9 liner
class Solution {     public int numSubarrayBoundedMax(int[] A, int L, int R) {         int res = 0;         for (int i = 0; i < A.length; i++) {             if 
```
class Solution {
    public int numSubarrayBoundedMax(int[] A, int L, int R) {
        int res = 0;
        for (int i = 0; i < A.length; i++) {
            if (A[i] > R) continue;
            int max = Integer.MIN_VALUE;
            for (int j = i; j < A.length; j++) {
                max = Math.max(max, A[j]);
                if (max > R) break;
                if (max >= L) res++;
            }
        }
        return res;
    }
}
```
[]