All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : July 29, 2024
Last updated : July 29, 2024
Related Topics : Array, Math, Dynamic Programming
Acceptance Rate : 73.63 %
class Solution:
def countSubarrays(self, nums: List[int]) -> int:
curr = []
output = 0
indx = 0
for num in nums :
if curr and curr[-1] >= num :
curr = []
curr.append(num)
output += len(curr)
indx += 1
return output