Testing case does not provide detail information


  • 0
    J

    In execution, I am seeing error in testing case:

    Last executed input: [], 1, 1

    But I tried locally, not seeing any problem, here is my code

    {

     public class Solution {
            public List<String> findMissingRanges(int[] A, int lower, int upper) {
                List<String> result = new ArrayList<String>();
        
                if (A == null || lower > upper) {
                    return result;
                }
                int start = -1;
                boolean state[] = new boolean[upper - lower + 1];
        
                for (int i : A) {
                    if (i >= lower && i <= upper) {
                        state[i - lower] = true;
                    }
                }
        
                for (int i = lower; i <= upper; i++) {
                    if (state[i - lower]) {
                        if (start == -1) {
                            continue;
                        } else if (start == i - lower - 1) {
                            result.add("" + (lower + start));
                        } else {
                            result.add((lower + start) + "->" + (i - 1));
                        }
                        start = -1;
                    } else {
                        if (start == -1) {
                            start = i - lower;
                        }
                    }
                }
                if (start == upper) {
                    result.add("" + upper);
                } else if (start != -1) {
                    if (start + lower == upper) {
                        result.add("" + upper);
                    } else {
                        result.add((start + lower) + "->" + upper);
                    }
                }
                return result;
            }
        
        }
    

    }


  • 0
    J

    Now I am seeing:
    Line 8: error: cannot find symbol: class FileWriter

    Seems there is some problem in the testing program :-)


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.