My LeetCode grinding. Trying to do a problem a day.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112
  1. class Solution:
  2. def runningSum(self, nums):
  3. run = 0
  4. res = []
  5. for x in nums:
  6. run = run + x
  7. res.append(run)
  8. return res
  9. s = Solution()
  10. print("Expected: [1, 2, 3, 4]")
  11. print("Got:", s.runningSum([1, 1, 1, 1]))