FastPrepMaximum Array Value

Maximum Array Value

Sierra logoSierra● EasyFULLTIMEOA
Learn

Problem statement

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

Function

maximumValue(nums: int[]) → int

Examples

Example 1

nums = [3,-2,7,4]return = 7

The largest value is 7.

Example 2

nums = [-8,-3,-11]return = -3

All values are negative, and -3 is the largest.

Constraints

  • 1 <= nums.length <= 100000
  • -1000000000 <= nums[i] <= 1000000000

More Sierra problems

See Sierra hiring insights
public int maximumValue(int[] nums) {
    // Write your code here.
}
nums[3,-2,7,4]
expected7
Checking account…