[python] 단어 변환
문제 출처 단어 변환 풀이 def dfs(now, target, words, history=[], depth=0): global min_ print(now, history) if now == target: min_ = min(min_, depth) if depth >= min_: return for word in words: if word in history: continue cnt = 0 for i in range(len(target)): if word[i] != now[i]: cnt += 1 if cnt > 1: break if cnt == 1 and word not in history: history.append(word) dfs(word, target, words, history, depth+1)..
2019. 9. 1.