This is my solution, but only 19 cases passed, could anyone tell me what scenarios it will go wrong?

...

public class MedianFinder {

```
boolean odd;
int medianIndex = -1;
ArrayList data = new ArrayList();
// Adds a number into the data structure.
public void addNum(int num) {
data.add(num);
odd = !odd;
if (odd) {
medianIndex++;
}
}
// Returns the median of current data stream
public double findMedian() {
if (odd) {
return (int)data.get(medianIndex) * 1.0;
}else {
return ((int)data.get(medianIndex) + (int)data.get(medianIndex+1))/2.0;
}
}
```

};

...