Problem 1163 · Hard

Last Substring in Lexicographical Order

Keep two candidate starts and compare their suffixes, discarding whole blocks that cannot hold the largest substring.

Open the interactive visualisation