Skip to content

Commit 1f16ef8

Browse files
iamAntimPalAntim-IWPIamShiwangi
committed
Create 1657. Determine if Two Strings Are Close.py
Co-Authored-By: Antim-IWP <[email protected]> Co-Authored-By: Shiwangi Srivastava <[email protected]>
1 parent 9541b9c commit 1f16ef8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def closeStrings(self, word1: str, word2: str) -> bool:
3+
cnt1, cnt2 = Counter(word1), Counter(word2)
4+
return sorted(cnt1.values()) == sorted(cnt2.values()) and set(
5+
cnt1.keys()
6+
) == set(cnt2.keys())

0 commit comments

Comments
 (0)