Running sum · סכום רץ
Running sum
Return a new array where position i holds the sum of all elements up to and including i: [1, 2, 3, 4] → [1, 3, 6, 10]. Keep a running total and fill a fresh int[] of the same length.
סכום רץ
החזר מערך חדש בו המיקום i מכיל את סכום כל האלמנטים עד ולכלול i: [1, 2, 3, 4] → [1, 3, 6, 10]. שמור על סכום רץ ומלא int[] חדש באותו אורך.
Complete runningSum(int[] nums) so result position i is the sum nums[0] + ... + nums[i]. Example: [1,2,3,4] becomes [1,3,6,10]. · השלם את runningSum(int[] nums) כדי שהתוצאה בi תהיה הסכום nums[0] + ... + nums[i]. דוגמה: [1,2,3,4] הופך ל[1,3,6,10].
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.