2020 第 39 周 LeetCode 记录

Yiran at 
1588. Sum of All Odd Length Subarrays 链接到标题 处理当长度为 1 时特殊情况,其他都遍历长度为奇数情况然后求和。class Solution: def sumOddLengthSubarrays(self, arr: List[int]) -> int: res = 0 for i in range(len(arr)+1): if i % 2: if i == 1: res += sum(arr) else: j = 0 while j + i str: cnt=text.……