Skip to content

Practice Count Complete Subarrays in an Array

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2799
LeetCode Problem

Count Complete Subarrays in an Array

Problem Statement

Count nonempty contiguous subarrays of nums containing every distinct value that occurs anywhere in nums. A value may appear more than once; only the set of distinct values matters.

Source: Count Complete Subarrays in an Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,3,1,2,2]
Output
4

# Example 2

Input
nums = [5,5,5,5]
Output
10

Constraints

1 <= nums.length <= 1000
1 <= nums[i] <= 2000

Related LeetCode Problems

Practice more problems similar to Count Complete Subarrays in an Array.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.