Given an array of integers nums, return the sum of all elements in the array.
For example, given [1, 2, 3, 4], the sum is 1 + 2 + 3 + 4 = 10.
If the array is empty, return 0.
nums = [1, 2, 3, 4]10nums = [-1, 1, -2, 2]0nums = [100]1000 <= nums.length <= 10^5-10^9 <= nums[i] <= 10^9The answer fits in a 64-bit signed integer.Run your code to see results
Use Cmd+Enter to run