1554. Strings Differ by One Character
Содержание
class Solution:
def differByOne(self, dict: List[str]) -> bool:
s = set()
for word in dict:
for i in range(len(word)):
t = word[:i] + "*" + word[i + 1 :]
if t in s:
return True
s.add(t)
return False