1697. Strings Differ by One Character

Medium
Hash Table
String
Rolling Hash
Hash Function

Description

Hints

Hint 1
BruteForce, check all pairs and verify if they differ in one character. O(n^2 * m) where n is the number of words and m is the length of each string.
Hint 2
O(m^2 * n), Use hashset, to insert all possible combinations adding a character "*". For example: If dict[i] = "abc", insert ("*bc", "a*c" and "ab*").

Statistics

Acceptance
40.4%
Submissions
67,607
Accepted
27,281