Count Subarrays With Score Less Than K
Try to solve the Count Subarrays With Score Less Than K problem.
We'll cover the following
Statement
An array score is defined as the sum of the array elements multiplied by its length. For example, if the array is
Given an array of positive integers, nums
, and a positive integer k
, count and return the number of non-empty subarrays of nums
whose score is strictly less than k
.
Note: A subarray is a contiguous sequence of elements within an array.
Constraints:
nums.length
nums[i]
k
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.