Boj 10867 중복 빼고 정렬하기
Updated:
문제 링크 : 백준 https://www.acmicpc.net/problem/10867
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Boj_10867 {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static int N;
static int[] arr;
public static void main(String[] args) throws NumberFormatException, IOException {
HashSet<Integer> set = new HashSet<>();
N = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine());
for(int i=0; i<N;i++) {
set.add(Integer.parseInt(st.nextToken()));
}
LinkedList<Integer> list = new LinkedList<>(set);
Collections.sort(list);
for(int i:list) {
System.out.print(i+" ");
}
}
}
Leave a comment