Loading...
No output yet. Run your code to see results.
Find Maximum in Array
#020
easy
array
algorithm
easy
Description
Write a function that finds the maximum number in an array of integers.
Example:
-
Input:
nums = [3, 5, 2, 8, 1] -
Output:
8 -
Input:
nums = [-1, -5, -3] -
Output:
-1
Instructions
- Return the maximum value in the array
- Handle arrays with negative numbers
- Assume the array has at least one element