The suffix array of s lists the starting positions of all its suffixes, in the dictionary order of the suffixes. For "banana" the suffixes sorted are a, ana, anana, banana, na, nana (starting at 5, 3, 1, 0, 4, 2), so the answer is [5, 3, 1, 0, 4, 2].
Example 1
Input:
suffix_array('banana')
Output:
[5, 3, 1, 0, 4, 2]
Example 2
Input:
suffix_array('aaaa')
Output:
[3, 2, 1, 0]
0 <= len(s) <= 10000No results yet
Run your code to check it against the examples, or submit to run every test.