Number Of Valid Subarrays
hard
Given an array nums of integers, return the number of non-empty continuous subarrays that satisfy the following condition: The leftmost element of the subarray is not larger than other elements in the subarray.
Constraints
1. 1 <= nums.length <= 50000 2. 0 <= nums[i] <= 100000
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
5
1
4
2
5
3
Sample Output
11
Question Video