/******************************************************* * Copyright (C) 2015 Haotian Wu * * This file is the solution to the question: * https://www.hackerrank.com/challenges/closest-numbers * * Redistribution and use in source and binary forms are permitted. *******************************************************/ #include #include #include #include #include #include #include #include #include using namespace std; // Sort the numbers, then look at every two adjacent numbers. // Use sort algorithm in #include . int main() { int n; int arr[200000]; scanf("%d",&n); for (int i=0;i closest_idx; int min_close = arr[1]-arr[0]+1; for (int i=0;i