Suffix Array and LCP Array

hard
Unit 25 · BFS II0/0 to milestone

A suffix array lists the starting positions of a string's suffixes in sorted order. Together with the LCP array (the longest common prefix of each adjacent pair), it answers many string questions quickly.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Suffix Array and LCP Array · TechGradify