4 ms·
It's also trivially solvable in O(1) time using a double-ended queue, but that would deviate from the "algorithm" proposed by the article.
by lvass 5y ago
It's also trivially solvable in O(1) time using a double-ended queue, but that would deviate from the "algorithm" proposed by the article.