Search
⌘K

Leetcode 2223. Sum of Scores of Built Strings

Given a string s, compute the sum of lengths of the longest common prefixes between s and every suffix s[i:], i.e., sum LCP(s, s[i:]) for all i. This is a linear-time string-matching problem (commonly solved with the Z-function) to handle n up to 1e5.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.