Hello i have a question for this challange.
I saw the most submitted answer and i want to ask which is better.
-
is most submitted
-
is my code
The runtime and memory usage a neraly the same.
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
sum = 0
sum_arr = []
for i in range(len(nums)):
sum += nums[i]
sum_arr.append(sum)
return sum_arr
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
sum = 0
sum_arr = []
for i in nums:
sum += i
sum_arr.append(sum)
return sum_arr
thank you in advance