Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Let’s say k is the number of distinct elements in the array. Our goal is to find the number of subarrays with k distinct elements.
Since the constraints are small, you can check every subarray.