2393. Count Strictly Increasing Subarrays

Обновлено: 2024-03-12
1 мин
[]

Содержание

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