📌  相关文章
📜  检查一个字符串交换是否可以使字符串相等 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:24.008000             🧑  作者: Mango

代码示例1
def areAlmostEqual(self, s1: str, s2: str) -> bool:
        if s2 == s1: return True

        for k in set(s1):
            if k not in s2: return False
        
        cnt = 0
        for i in range(len(s1)):
            if s1[i] != s2[i]:
                cnt += 1
        return cnt == 2