Is there any benefits as to using heaps compared to just going through the array using the sliding window technique and add the result to a dynamic list?
1 Like
I didn’t read the problem carefully and thought about finding an average instead of a median for some reason. Now I see I can’t use sliding window pattern alone when k > 2.
1 Like
I had the same reaction as well. The regular sliding window pattern is faster, shorter and better.