Lexicographically largest substring of a string

Revision en1, by Mikemirzyanov1, 2020-04-13 15:26:22

Hi can someone share the approach to find lexicographically largest substring in a string?

I know the answer will always be one of the suffixes but cannot find a way to analyze those suffixes efficiently.

Constraints |S| < 1e5

I need an O(n) approach or O(nlogn) without suffix array.

Any ideas are welcome.


I found this link on Leetcode but cannot understand it.

Tags #substrings


  Rev. Lang. By When Δ Comment
en1 English Mikemirzyanov1 2020-04-13 15:26:22 597 Initial revision (published)