https://school.programmers.co.kr/learn/courses/30/lessons/42748
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
1. 내가 작성한 코드
def solution(array, commands):
answer = []
for command in commands:
new_array = sorted(array[command[0]-1:command[1]])
answer.append(new_array[command[2]-1])
print(answer)
return answer
이렇게 풀긴 했는데, 다른 분이 푼 코드를 통해
변수를 이용해서 간단한 코드를 작성할 수 있다는 사실을 배웠다. ex) i,j,k = command
'🔅코딩테스트 공부🔅 > ❗프로그래머스(Lv.1)' 카테고리의 다른 글
[프로그래머스] Level1 기사단원의 무기(with python) (0) | 2023.02.08 |
---|---|
[프로그래머스] Level1 비밀지도(with python) (0) | 2023.02.07 |
[프로그래머스] Level1 체육복(with python) (0) | 2023.02.07 |
[프로그래머스] Level1 최대공약수와 최소공배수(with python) (0) | 2023.02.02 |
[프로그래머스] Level1 이상한 문자 만들기(with python) (0) | 2023.02.01 |
댓글