Write a function find_max(arr) that finds the maximum element in an array without using built-in max() or np.max().
Example:
Input: arr = [3, 7, 2, 9, 1, 5]
Output: 9
Constraints:
Test Cases
Test Case 1
Input:
[3, 7, 2, 9, 1, 5]Expected:
9Test Case 2
Input:
[1, 2, 3, 4, 5]Expected:
5Test Case 3
Input:
[-5, -2, -10, -1]Expected:
-1+ 2 hidden test cases
Python 3
Loading editor...
Console Output
Click "Run" to test your code or "Submit" to submit your solution.