Search
⌘K

Leetcode 2302. Count Subarrays With Score Less Than K

Count the number of non-empty contiguous subarrays of a positive-integer array whose score—defined as (sum of elements) × (subarray length)—is strictly less than k. With n up to 1e5 and values/k large, you need an algorithm substantially faster than brute-force O(n^2).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.