public static List<Interval> insert(ArrayList<Interval> intervals, Interval newInterval) {
       List<Interval> rel=new ArrayList<>();
       Interval j=newInterval;
       for (Interval i:intervals) {
           if (i.end<j.start) {
               rel.add(i);
           } else if (i.start>j.end) {
               rel.add(j);
               j=i;
           } else {
               j.start=Math.min(i.start, j.start);
               j.end=Math.max(i.end, j.end);
           }
       }
       rel.add(j);
       return rel;
   }