2302. Count Subarrays With Score Less Than K
Содержание
class Solution:
def countSubarrays(self, nums: List[int], k: int) -> int:
res = s = j = 0
for i, v in enumerate(nums):
s += v
while s * (i - j + 1) >= k:
s -= nums[j]
j += 1
res += i - j + 1
return res