Tap here to switch tabs
Problem
Submissions

Problem: Subarrays Distinct Element Sum of Squares I

Subarrays Distinct Element Sum of Squares I asks you to consider every contiguous subarray, count its unique values, square that count, and return the total.

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

Subarrays Distinct Element Sum of Squares I asks you to consider every contiguous subarray, count its unique values, square that count, and return the total.

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