The last the largest
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given array of n integers. Find the largest element of the array that occurs the last and swap it with the last element in the array without changing the order of other elements.
Input
First line contains positive integer n. Next line contains n integers. All numbers do not exceed 100 by absolute value.
Output
Print the elements of updated array.
Examples
Input #1
Answer #1
Submissions 12K
Acceptance rate 47%