3 ms·
No, it's possible to do much better https://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/ https://www.geeksforgeeks.org/slidi
by im3w1l 2y ago
No, it's possible to do much better https://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/ https://www.geeksforgeeks.org/sliding-window-maximum-maximum...
Edit: It should also be mentioned that due to the conjectured normality of pi, comparing two sequences will on average terminate very quickly, just looking at one or two digits will be enough most of the time, so a comparison is expected O(1).
- sponaugle 2y agoIndeed, the comparison length is 90% one hit, 99% two hits, etc.