-
1588. Sum of All Odd Length SubarraysAlgorithm/python tip 2021. 3. 1. 20:13
leetcode.com/problems/sum-of-all-odd-length-subarrays/
# 가능한 홀수 갯수 sublist class Solution(object): def sumOddLengthSubarrays(self, arr): ans = 0 for i in range(1, len(arr) + 1, 2): for j in range(0, len(arr) - i + 1): ans += sum(arr[j:j+i]) return ans
'Algorithm > python tip' 카테고리의 다른 글
1046. Last Stone Weight (0) 2021.03.02 [programmers] 스택/큐 - 기능개발 (0) 2021.03.02 1732. Find the Highest Altitude (0) 2021.03.01 1679. Max Number of K-Sum Pairs (0) 2021.03.01 137. Single Number II (0) 2021.03.01