프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(n, words):
answer = [0, 0]
cnt = 0
checks = []
checks.append(words[0])
for i in range(1, len(words)):
cnt += 1
if words[i] not in checks and words[i][0] == words[i-1][-1]:
checks.append(words[i])
else:
answer[0] = cnt%n + 1
answer[1] = cnt//n + 1
break
return answer
def solution(n, words):
answer = [0, 0]
for i in range(1, len(words)):
if words[i][0] != words[i-1][-1] or words[i] in words[:i]:
return [(i%n)+1, (i//n)+1]
else:
return answer
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 숫자 문자열과 영단어 python 파이썬 (0) | 2022.10.08 |
---|---|
프로그래머스 문자열 내 마음대로 정렬하기 (0) | 2022.10.08 |
프로그래머스 최솟값 만들기 python 파이썬 (0) | 2022.10.07 |
프로그래머스 JadenCase 문자열 만들기 python 파이썬 (0) | 2022.10.07 |
프로그래머스 최댓값과 최솟값 python 파이썬 (0) | 2022.10.07 |