Skyline
Submit solution
Points:
1
Time limit:
2.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
C, C++, Java, Python
Shahid has been tasked with designing two new skyscrapers to place on the Adelaide skyline! However, his employer already has a few designs in mind for him to pick from. Shahid knows that picking two buildings with the smallest height difference will have the best result, but he is too busy to look through all the designs himself. Your job is to look through the list of buildings, and find the two closest together in size.
Input
(
) - the number of buildings Shahid has to consider
(
) -
is the height of the
th building
Output
Output two integers - the heights of the buildings closest together in height, with the smaller first. It is guaranteed that there will be only one solution.
Example
Input 1
4
1 9 3 10
Output 1
9 10
Comments