LeetCode Python 859. Buddy Strings
-
[LeetCode/Python] 859. Buddy StringsAlgorithm/Leet Code 2020. 7. 12. 01:14
859. Buddy Strings Easy Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) != len(B) : return False elif A == B : setA = list(set(list(A))) if len(setA) < len(A) : return True else : return False diff = [] for i in range(len(A)) : if A[i] != ..