• [Swift]LeetCode1288. 删除被覆盖区间 | Remove Covered Intervals


    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    ➤微信公众号:山青咏芝(let_us_code)
    ➤博主域名:https://www.zengqiang.org
    ➤GitHub地址:https://github.com/strengthen/LeetCode
    ➤原文地址:https://www.cnblogs.com/strengthen/p/12151593.html
    ➤如果链接不是山青咏芝的博客园地址,则可能是爬取作者的文章。
    ➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!支持原创!
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

    Given a list of intervals, remove all intervals that are covered by another interval in the list. Interval [a,b) is covered by interval [c,d) if and only if c <= a and b <= d.

    After doing so, return the number of remaining intervals.

    Example 1:

    Input: intervals = [[1,4],[3,6],[2,8]]
    Output: 2
    Explanation: Interval [3,6] is covered by [2,8], therefore it is removed.
     

    Constraints:

    1 <= intervals.length <= 1000
    0 <= intervals[i][0] < intervals[i][1] <= 10^5
    intervals[i] != intervals[j] for all i != j



    给你一个区间列表,请你删除列表中被其他区间所覆盖的区间。

    只有当 c <= a 且 b <= d 时,我们才认为区间 [a,b) 被区间 [c,d) 覆盖。

    在完成所有删除操作后,请你返回列表中剩余区间的数目。

    示例:

    输入:intervals = [[1,4],[3,6],[2,8]]
    输出:2
    解释:区间 [3,6] 被区间 [2,8] 覆盖,所以它被删除了。
     

    提示:​​​​​​

    1 <= intervals.length <= 1000
    0 <= intervals[i][0] < intervals[i][1] <= 10^5
    对于所有的 i != j:intervals[i] != intervals[j]

  • 相关阅读:
    更好的抽屉效果(ios)
    系统拍照动画
    UITabBarController详解
    touch事件分发
    iOS UWebView详解
    iOS 监听声音按键
    webservice偶尔报黄页,解决方案
    FastReport脚本把数据绑定到文本控件上
    [转]js版的md5()
    JQuery中$.ajax()方法参数详解
  • 原文地址:https://www.cnblogs.com/strengthen/p/12151593.html
Copyright © 2020-2023  润新知