|Find the sum of all elements in an array....|General Coding Problems

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

Easy

Find the sum of all elements in an array.

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

Asked in

tcs

Examples

Example 1:
Input: [1,2,3,4,5]
Output: 15
Example 2:
Input: [10,-5,3]
Output: 8
Submit Result

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