8000 [LEET-295] add problem descriptions · aduispace/Leetcode-1@e625911 · GitHub
[go: up one dir, main page]

Skip to content

Commit e625911

Browse files
[LEET-295] add problem descriptions
1 parent 4899abe commit e625911

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

leetcode-algorithms/src/main/java/com/stevesun/solutions/FindMedianFromDataStream.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@
33
import java.util.*;
44

55
/**
6-
* Created by fishercoder1534 on 10/3/16.
6+
* Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.
7+
8+
Examples:
9+
[2,3,4] , the median is 3
10+
11+
[2,3], the median is (2 + 3) / 2 = 2.5
12+
13+
Design a data structure that supports the following two operations:
14+
15+
void addNum(int num) - Add a integer number from the data stream to the data structure.
16+
double findMedian() - Return the median of all elements so far.
17+
For example:
18+
19+
addNum(1)
20+
addNum(2)
21+
findMedian() -> 1.5
22+
addNum(3)
23+
findMedian() -> 2
724
*/
825
public class FindMedianFromDataStream {
926
}

0 commit comments

Comments
 (0)
0