← All problemsSign in

I - Suffix Array

You are given a string $S$ of length $N$. The suffix strings of $S$ are the non-empty strings which can be formed by deleting some (possibly $0$) characters from the beginning of $S$, i.e. for each $i$ ($1 \leq i \leq N$), the substring $S_i S_{i + 1} \ldots S_N$ is a suffix of $S$. There are $N-1$ suffix strings of $S$ that have length $\geq 2$. Your task is to sort these suffix strings of $

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start