쉽고 깔끔하게
[프로그래머스/python3] Level 1 제일 작은 수 제거하기 문제풀이 본문
728x90
반응형

문제
programmers.co.kr/learn/courses/30/lessons/12935
코딩테스트 연습 - 제일 작은 수 제거하기
정수를 저장한 배열, arr 에서 가장 작은 수를 제거한 배열을 리턴하는 함수, solution을 완성해주세요. 단, 리턴하려는 배열이 빈 배열인 경우엔 배열에 -1을 채워 리턴하세요. 예를들어 arr이 [4,3,2,1
programmers.co.kr
정수를 저장한 배열, arr에서 가장 작은 수를 제거한 배열을 리턴하는 함수, solution을 완성해주세요.
단, 리턴하려는 배열이 빈 배열인 경우엔 배열에 -1을 채워 리턴하세요.
<정답>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(arr): | |
arr.remove(min(arr)) | |
return arr or [-1] |
728x90
반응형
'Algorithm > Programmers' 카테고리의 다른 글
[프로그래머스/python3] Level 1 x만큼 간격이 있는 n개의 숫자 문제풀이 (0) | 2021.01.25 |
---|---|
[프로그래머스/python3] Level 1 문자열 내 p와 y의 개수 문제풀이 (0) | 2021.01.25 |
[프로그래머스/python3] Level 1 콜라츠 추측 문제풀이 (0) | 2021.01.22 |
[프로그래머스/python3] Level 1 내적 문제풀이 (0) | 2021.01.22 |
[프로그래머스/python3] Level 1 하샤드 수 문제풀이 (0) | 2021.01.22 |