NeetCode #484LC-3045HardTries
← Back to All Problems#484 · #3045 · Count Prefix and Suffix Pairs II(统计前后缀下标对 II)
📌 Problem Statement & Constraints
You are given an array of strings
words. Return the number of pairs (i, j) with i < j such that words[i] is both a prefix and a suffix of words[j]. Constraints: 1 <= words.length <= 10^5, 1 <= words[i].length <= 10^5, total length at most 5 * 10^5.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!