package leetcode.huawei;import java.util.ArrayList;import java.util.Arrays;import java.util.List;import java.util.Scanner;/*** @Description* @Author msli* @Date 2021年10月11日*/public class HJ3 {public static void main(String[] args) {Scanner in = new Scanner(System.in);while (in.hasNextInt()) {int n = in.nextInt();int[] temp = new int[n];for (int i = 0; i < n; i++) {temp[i] = in.nextInt();}Arrays.sort(temp);List<Integer> res = new ArrayList<>();for (int i = 0; i < temp.length; i++) {if (res.isEmpty() || res.get(res.size()-1) != temp[i]) {res.add(temp[i]);}}res.forEach(System.out::println);}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。