Skip to content
Onsite

Simple Array Sum

EasyP3Coding

Return the sum of all elements of nums. The sum of an empty array is 0.

Example 1

Input
nums = [1,2,3,4,10,11]
Output
31

Example 2

Input
nums = []
Output
0

Example 3

Input
nums = [5]
Output
5

Constraints

  • 0 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9

Hints

Run checks the 3 visible tests, Submit all 10.