What is a Suffix Array?

What is a Suffix Array?

Approach: Describe a sorted array of all suffixes of a string.

A sorted array of all suffixes of a string. It is more space-efficient than a Suffix Tree and can solve many of the same problems (like substring search).

Follow-up: How do you build it in O(n log n)?

Key concepts: lexicographical order, string matching, space efficiency.