Skip to content

Commit dc02f1e

Browse files
refactor(strings, similar string groups): is similar string function
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent a1cdbce commit dc02f1e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pystrings/similar_string_groups/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def is_similar(s1: str, s2: str) -> bool:
3636
j = positions_that_differ[1]
3737
return s1[i] == s2[j] and s1[j] == s2[i]
3838

39-
# Must have 0 diffs (identical) or 2 diffs (one swap)
40-
return diff_count == 0 or diff_count == 2
39+
# At this point, diff_count is either 0 or 1
40+
# Only 0 differences (identical strings) are similar
41+
return diff_count == 0
4142

4243
# Iterate over all unique pairs of strings
4344
for i in range(strs_len):

0 commit comments

Comments
 (0)