My LeetCode grinding. Trying to do a problem a day.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.py 267B

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]))