2393. Count Strictly Increasing Subarrays

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2393

class Solution:
    def countSubarrays(self, nums: List[int]) -> int:
        res = pre = cnt = 0
        for x in nums:
            if pre < x:
                cnt += 1
            else:
                cnt = 1
            pre = x
            res += cnt
        return res