C++ || Self explanable
\nclass Solution {\npublic:\n    int numSubarrayBoundedMax(vector<int>& nums, int left, int right) {\n    int s=0;\n        int n=nums.size();\n        int e=0;
```\nclass Solution {\npublic:\n    int numSubarrayBoundedMax(vector<int>& nums, int left, int right) {\n    int s=0;\n        int n=nums.size();\n        int e=0;\n        int prev=0;\n            int ans=0;\n        while(e<n){\n            if(left<=nums[e]&&nums[e]<=right){\n                prev=e-s+1;\n                ans+=prev;\n            }\n            else if(left>nums[e]){\n                ans+=prev;\n                \n            }\n            else{\n                prev=0;\n                s=e+1;\n                \n            }\n            e++;\n        }\n        return ans;\n    }\n};\n```
[]