기억은 짧고 기록은 길다
[프로그래머스/Programmers] 영어 끝말잇기 - Python 본문
Link
코딩테스트 연습 - 영어 끝말잇기
3 ["tank", "kick", "know", "wheel", "land", "dream", "mother", "robot", "tank"] [3,3] 5 ["hello", "observe", "effect", "take", "either", "recognize", "encourage", "ensure", "establish", "hang", "gather", "refer", "reference", "estimate", "executive"] [0,0]
programmers.co.kr
Solution
def solution(n, words):
for i in range(1, len(words)):
if words[i] in words[:i] or words[i - 1][-1] != words[i][0]:
return [i % n + 1, i // n + 1]
else:
return [0, 0]
🔑 key point: return [i % n + 1, i // n + 1]
'CodingTest > programmers' 카테고리의 다른 글
[프로그래머스/Programmers] 수식 최대화 - Python (0) | 2021.10.08 |
---|---|
[프로그래머스/Programmers] 오픈채팅방 - Python (0) | 2021.10.07 |
[프로그래머스/Programmers] 스킬트리 - Python (0) | 2021.10.05 |
[프로그래머스/Programmers] JadenCase 문자열 만들기 - Python (0) | 2021.10.04 |
[프로그래머스/Programmers] 큰 수 만들기 - Python (0) | 2021.10.03 |
Comments