Count unique values in subarrays
问题 Array a*b is given, which contains numbers up to 1e5, and we have to sum the count of unique numbers in every k*k subarray, there are a-k*b-k subarrays e.g 1 2 3 4 3 2 4 1 for k=2 subarrays are {1,2,3,2}(3distinct values) {2,3,2,4}(3distinct values) {3,4,4,1}(3distinct values) output is 9 Is there a faster approach than using a table which stores count of every number ocurrencies in an actaully processed k*k subarray(e.g at index 3 we store count of 3's in a subarray), moving a k*k window by