视频拼接 https://leetcode-cn.com/problems/video-stitching/ 
贪心算法 这道题其实是求最少用多少个区间能覆盖完整个区间。
按视频区间起点升序 对区间排序,如果起点相同则按终点降序 排序。使用贪心策略,在第一个区间的终点,寻找下一个终点最长的区间,依此类推。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 func  videoStitching (clips [][]int , time int )  int   {     sort.Slice(clips, func (i, j int )  bool   {         if  clips[i][0 ] == clips[j][0 ] {             return  clips[i][1 ] > clips[j][1 ]         } else  {             return  clips[i][0 ] < clips[j][0 ]         }     })     n := len (clips)     count := 0      currEnd, nextEnd := 0 , 0           for  i := 0 ; i < n && clips[i][0 ] <= currEnd; {         for  i < n && clips[i][0 ] <= currEnd {                          nextEnd = max(nextEnd, clips[i][1 ])             i++         }                  count++         currEnd = nextEnd                  if  currEnd >= time {             return  count         }     }     return  -1  }func  max (values ...int )  int   {     res := values[0 ]     for  _, v := range  values {         if  v > res {             res = v         }     }     return  res }