← 返回 amazon 的题目列表Find the Maximum Element in an Array
类型:online_judge
Given an array of integers, write a function to find the maximum element in the array.
Input
An array arr of n integers, where 1 <= n <= 10^5.
Output
The maximum integer in the array.
Example
Input: arr = [1, 3, 4, 2, 5] Output: 5
Note
Ensure that your program can complete in O(n) time.
Example
Input
[1, 3, 4, 2, 5]