EasyArray· 71% acceptance
#26

Find Maximum Element 26

Easy

Given an integer array `nums` of length n, return the largest value in the array. This is variant **#26** — arrays may include negative numbers.

Example 1

Input: nums = [58,65,72,-18,-11,-4,3,10,17,24,31,38,45,52,59,66,73,-17,-10,-3,4,11,18,25,32,39,46,53,60,67,74]

Output: 74

Constraints

  • 1 <= nums.length <= 10^4
  • -10^4 <= nums[i] <= 10^4

Acceptance: 71% · Topics: array, iteration

findMax

← All practice problems