What is a LCP (Longest Common Prefix) Array?

What is a LCP (Longest Common Prefix) Array?

Approach: Describe an array used alongside suffix arrays.

An auxiliary data structure to the suffix array. It stores the lengths of the longest common prefixes between each pair of consecutive suffixes in the sorted suffix array.

Follow-up: What can you solve using LCP and Suffix Arrays? (e.g., longest repeated substring)

Key concepts: suffix array, string processing.