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 246ac78 commit 288f512Copy full SHA for 288f512
find-median-from-data-stream/KwonNayeon.py
@@ -4,6 +4,8 @@
4
- There will be at least one element in the data structure before calling findMedian.
5
- At most 5 * 10^4 calls will be made to addNum and findMedian.
6
7
+<Solution 1: 리스트 활용>
8
+
9
Time Complexity:
10
- addNum(): O(nlogn)
11
- 매번 정렬하기 때문
@@ -41,3 +43,15 @@ def findMedian(self) -> float:
41
43
mid2 = self.nums[n // 2]
42
44
return (mid1 + mid2) / 2.0
45
46
+"""
47
+<Solution 2: 힙 활용>
48
49
+Time Complexity:
50
51
+Space Complexity:
52
53
+풀이방법:
54
55
56
+from heapq import heappop, heappush
57
0 commit comments