Search
⌘K

Leetcode 2913. Subarrays Distinct Element Sum of Squares I

Return the sum, over all non-empty contiguous subarrays of nums, of the square of the number of distinct values in each subarray. The core challenge is counting distinct elements per subarray; with n ≤ 100 (values ≤ 100) brute-force enumeration of subarrays is acceptable.


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.