def solution(n, words):
used = {words[0]}
for i in range(1, len(words)):
if words[i][0] != words[i - 1][-1] or words[i] in used:
return [(i % n) + 1, (i // n) + 1]
used.add(words[i])
return [0, 0]
'PS' 카테고리의 다른 글
| 프로그래머스 12978 Python [배달, 다익스트라 알고리즘] (0) | 2026.08.27 |
|---|---|
| 프로그래머스 42577 Python [전화번호 목록] (0) | 2026.08.27 |
| 프로그래머스 1844 Python [게임 맵 최단거리] (0) | 2026.08.13 |
| 프로그래머스 42748 Python [K번째수] (0) | 2026.08.13 |
| 프로그래머스 159993 Python [미로 탈출] (0) | 2026.08.12 |