← ALL NOTES
Array

1852. Distinct Numbers in Each Subarray

Given nums and k, for each length-k window (there are n−k+1 of them) report the count of distinct elements. A fixed-size sliding window with a frequency map and a live distinct counter answers every…

Loading…