Notice
Recent Posts
Recent Comments
- Today
- Total
01-10 22:06
Tags
- database
- ํ๋ก๊ทธ๋๋จธ์ค
- PS
- pytorch
- MST
- OOP
- ๋ฐฑ์ค
- tree
- dp
- Algorithm
- array
- ๋ฒจ๋งํฌ๋
- spring
- java
- leetcode
- BFS
- Graph
- ๋ฌธ๋ฒ
- ๋ค์ต์คํธ๋ผ
- ๋ฐฑ์๋
- ์๋ฃ๊ตฌ์กฐ
- ์๋ฐ
- ์๋ฐ์์ ์
- ์์์ ๋ ฌ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ๊ทธ๋ฆฌ๋
- ๊ตฌํ
- CS
- ์ธํด
- ์กธ์ ์ํ
Link
Partially Committed
[์ ๋ ฌ] ๊ฐ์ฅ ํฐ ์ (JAVA) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
SMALL
https://school.programmers.co.kr/learn/courses/30/lessons/42746?language=java
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
class Solution {
public String solution(int[] numbers) throws IOException {
StringBuilder answer = new StringBuilder();
String[] result = new String[numbers.length];
for(int i = 0 ; i < numbers.length; i++)
result[i] = String.valueOf(numbers[i]);
Arrays.sort(result, new Comparator<String>(){
@Override
public int compare(String o1, String o2){
return (o2+o1).compareTo(o1+o2);
}
});
for(String e : result)
answer.append(e);
if(answer.charAt(0) == '0') return "0";
return answer.toString();
}
}
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์คํ/ํ] ์ฌ๋ฐ๋ฅธ ๊ดํธ (JAVA) (0) | 2022.09.03 |
---|---|
[๋ฐฐ์ด] ๊ฐ์ ์ซ์๋ ์ซ์ด (JAVA) (0) | 2022.09.02 |
[์ ๋ ฌ] K ๋ฒ์งธ์ (JAVA) (0) | 2022.09.02 |
[ํ๋ก๊ทธ๋๋จธ์ค] ํฐ ์ ๋ง๋ค๊ธฐ (0) | 2022.07.14 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฒ์ ๋งต ์ต๋จ๊ฑฐ๋ฆฌ (0) | 2022.07.14 |
Comments