Skip to content

Commit bcea009

Browse files
authored
Update k-similar-strings.py
1 parent ef5f1ab commit bcea009

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Python/k-similar-strings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Time: O(s * s!/(a!*...*z!)), s is the length of A, B,
2-
# a...z is the count of each alphabet,
3-
# sum(a...z) = s
4-
# Space: O(s * s!/(a!*...*z!))
1+
# Time: O(n * n!/(c_a!*...*c_z!), n is the length of A, B,
2+
# c_a...c_z is the count of each alphabet,
3+
# n = sum(c_a...c_z)
4+
# Space: O(n * n!/(c_a!*...*c_z!)
55

66
# Strings A and B are K-similar (for some non-negative integer K)
77
# if we can swap the positions of two letters

0 commit comments

Comments
 (0)