No, it's possible to do much better 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).