문제 : 프로그래머스
https://programmers.co.kr/skill_checks/369129?challenge_id=947
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이 :
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public long solution(long n) {
long answer = 0;
char[] a = n.ToString().ToCharArray();
Array.Sort(a);
Array.Reverse(a);
answer = Convert.ToInt64(new string(a));
return answer;
}
}
'알고리즘 예제 > C#' 카테고리의 다른 글
[C#] 백준 알고리즘 - 설탕 배달 (0) | 2022.05.19 |
---|