Sum of Array Elements
EasyAcceptance: N/A
Given an array of integers nums, return the sum of all elements in the array.
Example 1:
Input: nums = [1, 2, 3, 4, 5]
Output: 15
Explanation: 1 + 2 + 3 + 4 + 5 = 15
Example 2:
Input: nums = [-1, -2, -3]
Output: -6
Explanation: -1 + -2 + -3 = -6
Constraints:
- 1 <= nums.length <= 1000
- -1000 <= nums[i] <= 1000
Discussion
Please login to view and join the discussion.
Login to ContinueLoading...
Status:Not run yet
Run your code to see results