@@ -0,0 +1,1338 @@
+package com.hackerrank.contests.daysOfCode_30;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.Scanner;%0A%0Apublic class Day16_Sorting %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09%0A%09%09@SuppressWarnings(%22resource%22)%0A%09%09Scanner scanner = new Scanner(System.in);%0A%09%09int N = scanner.nextInt();%0A%09%09List%3CInteger%3E listA = new ArrayList%3CInteger%3E();%0A%09%09%0A%09%09for (int i = 0; i %3C N; i++) %7B%0A%09%09%09listA.add(scanner.nextInt());%0A%09%09%7D%0A%09%09Collections.sort(listA);%0A%09%09//System.out.println(listA);%0A%09%09%0A%09%09List%3CInteger%3E listDifference = new ArrayList%3CInteger%3E();%0A%09%09Integer difference = null;%0A%09%09for (int i = 0; i %3C listA.size() - 1; i++) %7B%0A%09%09%09difference = Math.abs(listA.get(i) - listA.get(i + 1));%0A%09%09%09listDifference.add(difference);%0A%09%09%7D%0A%09%09//System.out.println(listDifference);%0A%09%09Collections.sort(listDifference);%0A%09%09//System.out.println(listDifference);%0A%09%09//System.out.println(listDifference.get(0));%0A%09%09%0A%09%09//List%3CInteger%3E outputList = new ArrayList%3CInteger%3E();%0A%09%09for (int i = 0; i %3C listA.size() - 1; i++) %7B%0A%09%09%09if (Math.abs((listA.get(i) - listA.get(i + 1))) == listDifference.get(0)) %7B%0A%09%09%09%09//outputList.add(listA.get(i));%0A%09%09%09%09//outputList.add(listA.get(i + 1));%0A%09%09%09%09System.out.print(listA.get(i) + %22 %22 + listA.get(i + 1) + %22 %22);%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09%7D%0A%09%09//System.out.println(outputList);%0A%0A%09%7D%0A%0A%7D%0A

Create Day16_Sorting.java