Search
⌘K

Leetcode 3042. Count Prefix and Suffix Pairs I

Count the number of index pairs (i < j) such that words[i] is both a prefix and a suffix of words[j] (i.e., words[j] starts and ends with words[i]). With n ≤ 50 and word length ≤ 10, this can be solved directly by pairwise string comparisons.


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.