Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use a set or map to keep track of the number of distinct elements.
Use 2-pointers to maintain the size, the number of unique elements, and the sum of all the elements in all subarrays of size k from left to right dynamically.****