TC: O(N) | Easy and clean solution using two-pointers
\nclass Solution {\n    public int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        int start = -1, end = -1, res = 0;\n        for(int i=0; i<
```\nclass Solution {\n    public int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        int start = -1, end = -1, res = 0;\n        for(int i=0; i<nums.length; i++){\n            if(nums[i] > right){\n                start = end = i;\n                continue;\n            }\n            if(nums[i] >=left){\n                end = i;\n            }\n            res += end - start;\n        }\n        return res;\n    }\n}\n```
['Two Pointers', 'Java']