~/algor $ cat problems/array/swap-the-smallest-and-the-largest
Swap the smallest and the largest
Easy
1000 ms
128 MB
32%
A positive integer and an array of distinct integers are given. Swap the smallest and the largest elements of the array and print the array.
Input
The first line contains a positive integer . The second line contains integers separated by spaces.
Output
One line with integers separated by spaces.
Note
All numbers are distinct.
Examples
Input #1
5 15 3 42 99 27
Output #1
15 99 42 3 27
Input #2
3 10 50 30
Output #2
50 10 30