Available question text
Count pairs (i < j) where words[i] is both a prefix and a suffix of words[j]. With up to 5e5 total characters, the challenge is to avoid quadratic pairwise checks and use efficient string-matching or grouping by word/length (e.g., hashing/trie/KMP) to count matches.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3045. Count Prefix and Suffix Pairs II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source