프로그래머스. 정수 내림차순으로 배치하기 파이썬 풀이

minan·2021년 6월 25일
0

프로그래머스

목록 보기
58/92

프로그래머스. 연습문제. Level 1. 정수 내림차순으로 배치하기 파이썬 풀이

문제링크 https://programmers.co.kr/learn/courses/30/lessons/12933

먼저 숫자 n을 list 형식으로 바꿔주고 내림차순 정렬을 한 뒤 int형으로 바꿔서 return

def solution(n):
    
    n = list(str(n))
    n.sort(reverse=True)
    
    return int("".join(n))
profile
https://github.com/minhaaan

0개의 댓글