title: "[프로그래머스] 영어 끝말잇기 Python 파이썬 해설 (Level 2) - 이도훈"
cleanUrl: "programmers/12981"
description: "프로그래머스 Level 2 문제 [영어 끝말잇기]의 풀이를 정리합니다."

문제 설명 및 제한사항

아이디어 및 해결 방법

코드

def solution(n, words):
    start, history = None, set()
    for i, word in enumerate(words):
        if word in history or (start is not None and word[0] != start):
            return [i % n + 1, i // n + 1]
        
        history.add(word)
        start = word[-1]
    
    return [0, 0]

출처

프로그래머스 코딩테스트 연습 https://school.programmers.co.kr/learn/challenges