← Salesforce questions
CodingReported in a candidate post, Sep 2022

LPS array and counting occurrences of s in t in O(|s|+|t|)

Filed under Salesforce

Explain and compute the LPS array (for each prefix of a pattern, the length of its longest proper prefix that is also a suffix), then use it to count occurrences of string s in string t in O(|s| +…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Salesforce questions

Collected from public candidate posts and coding forums. Updated Nov 2026.