标签:rem remove erb orderby min int 修改 turn order
public class Solution { public IList<Interval> Merge(IList<Interval> intervals) { var len = intervals.Count; if (len == 1) { return intervals; } var list = intervals.OrderBy(x => x.start).ToList(); int i = 0; while (i < list.Count) { int j = i; while (i < list.Count - 1 && list[j].end >= list[i + 1].start) { //可以融合 //前项修改,后项删除 list[j].start = Math.Min(list[j].start, list[i + 1].start); list[j].end = Math.Max(list[j].end, list[i + 1].end); list.RemoveAt(i + 1); } i++; } return list; } }
标签:rem remove erb orderby min int 修改 turn order
原文地址:https://www.cnblogs.com/asenyang/p/9747123.html