We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f3271cc commit 65406f8Copy full SHA for 65406f8
README.md
@@ -2312,6 +2312,14 @@ class Solution:
2312
return n <= sum((len(i) - 1) // 2 for i in s)
2313
```
2314
- 两边都加 0, 然后按 1 分割
2315
+## [643. 子数组最大平均数 I 2行](https://leetcode.com/problems/maximum-average-subarray-i/)
2316
+```python
2317
+class Solution:
2318
+ def findMaxAverage(self, nums: List[int], k: int) -> float:
2319
+ presum = [0, *accumulate(nums, add)]
2320
+ return max(presum[i + 1] - presum[i + 1 - k] for i in range(k - 1, len(nums))) / float(k)
2321
+```
2322
+- 前缀和
2323
## [652. Find Duplicate Subtrees 8行](https://leetcode.com/problems/find-duplicate-subtrees/)
2324
```python
2325
# Definition for a binary tree node.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments