Problems > Maximum of an Array

Maximum of an Array

Difficulty: 900 1000 ms 128 MB

implementation

Given a list of integers, print the largest one.

Input: the first line has an integer N (1 ≤ N ≤ 105). The second line has N integers (−109 ≤ ai ≤ 109) separated by spaces.

Output: the maximum value.

Sample Tests

Input 1
5
1 5 2 4 3
Output 1
5
Input 2
3
-7 -2 -9
Output 2
-2

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.