Distinct substrings of BARBARIAN
How many distinct non-empty contiguous substrings does the word barbarian have? (Substrings are compared as strings, so bar counts once however often it occurs.)
Show hints (3)+
- Every substring is a prefix of at least one suffix - count it only at the first suffix (in sorted order) that has it.
- Sort the 9 suffixes and compute each one's longest common prefix with its predecessor.
- Answer .
Answer
Reveal answer →Final answer
38
Create a free account to see the full worked solution and track your progress.
Interview format: Prop Trading