Python -  2 Pointers Approach
```\nclass Solution:\n    def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int:\n        \n            start=count=cur=0\n            
```\nclass Solution:\n    def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int:\n        \n            start=count=cur=0\n            \n            for i in range(len(nums)):\n                \n                if left <= nums[i] <= right:\n                    cur=i-start+1\n                    \n                elif nums[i] > right:\n                    cur=0\n                    start=i+1\n                    \n                count+=cur\n                \n            return count
['Python']