<jupyter_start><jupyter_text>2020년 11월 12일 목요일 leetCode - Buddy Strings (Python) 문제 : https://leetcode.com/problems/buddy-strings/ 블로그 : https://somjang.tistory.com/entry/leetCode-859-Buddy-Strings-Python  첫번째 시도<jupyter_code>class Solution:
    def buddyStrings(self, A: str, B: str) -> bool:
        if len(A) != len(B):
            return False
        else:
            list_A = list(A)
            list_B = list(B)
            
            check_string_A = []
            check_string_B = []
            
            
            for i in range(len(list_A)):
                if list_A[i] != list_B[i]:
                    check_string_A.append(list_A[i])
                    check_string_B.append(list_B[i])
                    
                    if len(check_string_A) > 2:
                        return False
            if len(check_string_A) == 2 and check_string_A[::-1] == check_string_B:
                return True
            
            if len(check_string_A) == 0:
                if len(list_A) > len(set(list_A)):
                    return True
                return False<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10213143872113677, 'fraction_numerical': 0.013321492007104795, 'mean_word_length': 1.4341252699784017, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '264638', 'license': 'MIT', 'n_tokens_mistral': 385, 'n_tokens_neox': 374, 'n_words': 66, 'path': 'DAY 201 ~ 300/DAY258_[leetCode] Buddy Strings (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '1126'}