Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 317 Bytes

1657.-determine-if-two-strings-are-close.md

File metadata and controls

11 lines (8 loc) · 317 Bytes

1657. Determine if Two Strings Are Close

class Solution:
    def closeStrings(self, word1: str, word2: str) -> bool:
        
        c1 = collections.Counter(word1)
        c2 = collections.Counter(word2)
        return  not (c1.keys() ^ c2.keys())  and sorted(c1.values())  == sorted(c2.values())