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