You are given an integer array nums and a queries, where each queries[i] is a pair of indices
A subarray is considered stable if its elements appear in non decreasing order.
For each query queries[i], determine the number of stable subarrays contained entirely within the range nums.
Return an array ans where ans[i] represents the answer to the
Note: A subarray of length
is always considered stable.
Constraints:
nums.length
nums[i]
queries.length
queries[i] = [l_i, r_i]
nums.length
You are given an integer array nums and a queries, where each queries[i] is a pair of indices
A subarray is considered stable if its elements appear in non decreasing order.
For each query queries[i], determine the number of stable subarrays contained entirely within the range nums.
Return an array ans where ans[i] represents the answer to the
Note: A subarray of length
is always considered stable.
Constraints:
nums.length
nums[i]
queries.length
queries[i] = [l_i, r_i]
nums.length