Array Maximum

EasyArray

Description

Given a non-empty array of integers nums, return the largest value.

Examples

Input:nums = [3,1,4,1,5]
Output:5
Explanation:

The largest value present in the list is 5.

Input:nums = [-7,-2,-9]
Output:-2
Explanation:

The largest value present in the list is -2.

Input:nums = [42]
Output:42
Explanation:

The largest value present in the list is 42.

Constraints

  • 1 ≤ nums.length ≤ 10⁴
  • -10⁹ ≤ nums[i] ≤ 10⁹

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.