def solution(nums, divisor):
answer = []
for num in nums:
if num % divisor == 0:
answer.append(num)
return [-1] if len(answer) == 0 else sorted(answer)
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 제일 작은 수 제거하기(python) (0) | 2021.05.25 |
---|---|
[프로그래머스] 문자열 내림차순으로 배치하기 (python) (0) | 2021.05.22 |
[프로그래머스] 짝수와 홀수 (python) (0) | 2021.05.16 |
[프로그래머스] 수박수박수박수박수박수? (python) (0) | 2021.05.15 |
[프로그래머스] 영어 끝말잇기(python) (0) | 2021.05.14 |
댓글