[#1782] note(MaxAverageRatio): add complexity describe

This commit is contained in:
2025-09-01 14:53:36 +08:00
parent a37a374c24
commit ac6bc1010e

View File

@@ -28,14 +28,14 @@ Return the *maximum* possible average pass ratio after assigning the `extraStude
- 思路: - 思路:
- 每次分配一個學生看哪個班級提升率會最高 - 每次分配一個學生看哪個班級提升率會最高
- leetcode 這邊會 time limit exceeded - leetcode 這邊會 time limit exceeded
- 時間複雜度O(N) - 時間複雜度O(N^2)
- 空間複雜度O(N) - 空間複雜度O(N)
2. **最佳解法**: 2. **最佳解法**:
- 思路: - 思路:
- Priority Queue(Max Heap) 存每個班級潛在 - Priority Queue(Max Heap) 直接找gain最大的
- 時間複雜度O(?) - 時間複雜度O(log N)
- 空間複雜度O(?) - 空間複雜度O(N)
## 測試案例 ## 測試案例