https://school.programmers.co.kr/learn/courses/30/lessons/134240?language=python3
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(food):
answer = []
for idx, num in enumerate(food):
if idx == 0:
continue
for _ in range(num//2):
answer.append(str(idx))
answer.append(str(0))
return ''.join(answer) + ''.join(answer[-2::-1])
print(solution([1, 3, 4, 6]))
print(solution([1, 7, 1, 2]))
'Coding Test > 프로그래머스' 카테고리의 다른 글
[프로그래머스] / [Level 2] / [Python] 연속된 부분 수열의 합 (0) | 2023.06.27 |
---|---|
[프로그래머스] / [Level 1] / [Python] 가장 가까운 같은 글자 (0) | 2023.06.27 |
[프로그래머스] / [Level 1] / [Python] 공원 산책 (0) | 2023.04.10 |
[프로그래머스] / [Level 3] / [Python] 등굣길 (0) | 2023.04.03 |
[프로그래머스] / [Level 3] / [Python] 야근 지수 (0) | 2023.04.03 |