java solution || easy to understand
Please UPVOTE if you like my solution!\n\nclass Solution {\n    public int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        int count = 0,ans =
Please **UPVOTE** if you like my solution!\n```\nclass Solution {\n    public int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        int count = 0,ans = 0,i = 0,j = 0;\n        \n        while(j<nums.length){\n            if(nums[j]>right){\n                count = 0;\n                i = j+1;\n            }\n            else if(nums[j]>=left && nums[j]<=right){\n                count = j-i+1;\n            }\n            ans += count;\n            j++;\n        }\n        \n        return ans;\n    }\n}\n```
['Java']