Submit | All submissions | Best solutions | Back to list |
EIUPH012 - Largest even number |
Given an array of n integers. Find the largest even number in the array.
Input
The first line contains the integer n (n <= 10^5).
The second line contains n integers ai (|ai| <= 10^9 - denoted by | N | is the absolute value of N) are the numbers in the array.
Output
Output the largest even number in the array. If no even number is found, output -1.
Example
Input: 5 1 2 -3 -4 6 Output: 6 Input: 3 1 3 5 Output: -1