All tasks
Easyarraysloops

Maximum of an Array

Time limit 2 s · Memory 64 MBAcceptance: 42.9%Solved by: 3

Statement

The first line contains n, the second line contains n integers separated by spaces. Print the largest of them.

Examples

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

Constraints

  • 1 ≤ n ≤ 10^5
  • -10^9 ≤ a_i ≤ 10^9
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.