|Find the largest element in an array....|General Coding Problems

fn max_element(nums: &[i32]) -> i32

Easy

Find the largest element in an array.

fn max_element(nums: &[i32]) -> i32

Asked in

wipro

Examples

Example 1:
Input: [1,5,3,9,2]
Output: 9
Example 2:
Input: [-5,-2,-10,-1]
Output: -1
Submit Result

Click Run to test sample cases, or Submit to evaluate all cases