Given an integer array capacity, return the total number of stable subarrays.
A subarray capacity[l...r] is considered stable if it satisfies the following conditions:
The subarray has a length of at least
The boundary elements are equal, such that capacity[l] == capacity[r].
The sum of the interior elements strictly between index l and index r is equal to capacity[l].
Constraints:
capacity.length
capacity[i]
Given an integer array capacity, return the total number of stable subarrays.
A subarray capacity[l...r] is considered stable if it satisfies the following conditions:
The subarray has a length of at least
The boundary elements are equal, such that capacity[l] == capacity[r].
The sum of the interior elements strictly between index l and index r is equal to capacity[l].
Constraints:
capacity.length
capacity[i]