My LeetCode grinding. Trying to do a problem a day.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

problem.txt 551B

123456789101112131415161718192021222324252627282930
  1. Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]).
  2. Return the running sum of nums.
  3. Example 1:
  4. Input: nums = [1,2,3,4]
  5. Output: [1,3,6,10]
  6. Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4].
  7. Example 2:
  8. Input: nums = [1,1,1,1,1]
  9. Output: [1,2,3,4,5]
  10. Explanation: Running sum is obtained as follows: [1, 1+1, 1+1+1, 1+1+1+1, 1+1+1+1+1].
  11. Example 3:
  12. Input: nums = [3,1,2,10,1]
  13. Output: [3,4,6,16,17]
  14. Constraints:
  15. 1 <= nums.length <= 1000
  16. -10^6 <= nums[i] <= 10^6