Sum of All Odd Length Subarrays
class Solution:
def sumOddLengthSubarrays(self, arr: List[int]) -> int:
total = 0
for wsize in range(1, 1 + len(arr), 2):
for ix in range(len(arr) - wsize + 1):
total = total + sum(arr[ix:ix + wsize])
return total