I find some topics with most votes can't pass all the test cases.

So, i wrote my own answer. Little ugly but work.

```
public List<String> findMissingRanges(int[] nums, int lower, int upper) {
List<String> res = new ArrayList<>();
int number = lower;
for(int i = 0; i < nums.length; i ++) {
if(nums[i] == number + 1) {
res.add(number + "");
} else if(nums[i] > number + 1){
res.add(number + "->" + (nums[i] - 1));
}
number = nums[i];
number ++;
}
if(number == Integer.MIN_VALUE) return res;
if(number == upper) {
res.add(number + "");
} else if(number < upper) {
res.add(number + "->" + upper);
}
return res;
}
```