[LeetCode] Subarrays Distinct Element Sum of Squares I

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 of nums consisting of all the indices from i to j such that 0 <= i <= j < nums.length. Then the number of distinct values in nums[i..j] is called the distinct count of nums[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.

Read more
[Codeforces] Round 524 (Div. 2) D. Olya and magical squareRead more
[Codeforces] Educational Round 55 (Rated for Div. 2) E. Increasing FrequencyRead more
[Codeforces] Round 526 (Div. 1) B. The Fair Nut and StringsRead more
[Codeforces] Round 525 (Div. 2) D. Ehab and another another xor problemRead more
[Codeforces] Round 527 (Div. 3) E. Minimal Diameter ForestRead more
[Hacker Earth] Capitals and citiesRead more
[Hacker Earth] N girlsRead more
[Hacker Earth] Shelters and TunnelsRead more
[Hacker Earth] Pairwise ProductsRead more