filmov
tv
sum of parts | 6kyu codewars | slower solution

Показать описание
🅳🅴🆂🅲🆁🅸🅿🆃🅸🅾🅽 :
Let us consider this example (array written in general format):
ls = [0, 1, 3, 6, 10]
Its following parts:
ls = [0, 1, 3, 6, 10]
ls = [1, 3, 6, 10]
ls = [3, 6, 10]
ls = [6, 10]
ls = [10]
ls = []
The corresponding sums are (put together in a list): [20, 20, 19, 16, 10, 0]