Tap here to switch tabs
Problem
Submissions

Problem: Subarrays Distinct Element Sum of Squares I

med
30 min
Try to solve the Subarrays Distinct Element Sum of Squares I problem.

Statement

You are given an integer array nums.

The distinct count of a subarray is defined as the number of unique elements present in that subarray.

Return the sum of the squares of distinct counts across all contiguous subarrays of nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Subarrays Distinct Element Sum of Squares I

med
30 min
Try to solve the Subarrays Distinct Element Sum of Squares I problem.

Statement

You are given an integer array nums.

The distinct count of a subarray is defined as the number of unique elements present in that subarray.

Return the sum of the squares of distinct counts across all contiguous subarrays of nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100