2913. Subarrays Distinct Element Sum of Squares I
You are given a 0-indexed integer array
nums
.The distinct count of a subarray of
nums
is defined as:
- Let
nums[i..j]
be a subarray ofnums
consisting of all the indices fromi
toj
such that0 <= i <= j < nums.length
. Then the number of distinct values innums[i..j]
is called the distinct count ofnums[i..j]
.Return the sum of the squares of distinct counts of all subarrays of
nums
.A subarray is a contiguous non-empty sequence of elements within an array.
1 | class Solution { |