[抄题]:

A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.

Two rectangles overlap if the area of their intersection is positive.  To be clear, two rectangles that only touch at the corner or edges do not overlap.

Given two (axis-aligned) rectangles, return whether they overlap.

Example 1:

Input: rec1 = [0,0,2,2], rec2 = [1,1,3,3]
Output: true

[暴力解法]:

时间分析:

空间分析:

[优化后]:

时间分析:

空间分析:

[奇葩输出条件]:

[奇葩corner case]:

[思维问题]:

[英文数据结构或算法,为什么不用别的数据结构或算法]:

[一句话思路]:

[输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入):

[画图]:

[一刷]:

[二刷]:

[三刷]:

[四刷]:

[五刷]:

[五分钟肉眼debug的结果]:

[总结]:

[复杂度]:Time complexity: O(n) Space complexity: O(1)

[算法思想:迭代/递归/分治/贪心]:

[关键模板化代码]:

[其他解法]:

[Follow Up]:

[LC给出的题目变变变]:

[代码风格] :

[是否头一次写此类driver funcion的代码] :

[潜台词] :

class Solution {
public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
return rec1[0] < rec2[2] && rec1[1] < rec2[3] && rec2[0] < rec1[2] && rec2[1] < rec1[3];
}
}

836. Rectangle Overlap 矩形重叠的更多相关文章

  1. [LeetCode] Rectangle Overlap 矩形重叠

    A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bot ...

  2. 【Leetcode_easy】836. Rectangle Overlap

    problem 836. Rectangle Overlap solution: class Solution { public: bool isRectangleOverlap(vector< ...

  3. Leetcode836.Rectangle Overlap矩阵重叠

    矩形以列表 [x1, y1, x2, y2] 的形式表示,其中 (x1, y1) 为左下角的坐标,(x2, y2) 是右上角的坐标. 如果相交的面积为正,则称两矩形重叠.需要明确的是,只在角或边接触的 ...

  4. 836. Rectangle Overlap ——weekly contest 85

    Rectangle Overlap A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coor ...

  5. 【LeetCode】836. Rectangle Overlap 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/rectangle ...

  6. #Leetcode# 836. Rectangle Overlap

    https://leetcode.com/problems/rectangle-overlap/ A rectangle is represented as a list [x1, y1, x2, y ...

  7. [LeetCode&Python] Problem 836. Rectangle Overlap

    A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bot ...

  8. 836. Rectangle Overlap

    class Solution { public: bool isRectangleOverlap(vector<int>& rec1, vector<int>& ...

  9. [Swift]LeetCode836. 矩形重叠 | Rectangle Overlap

    A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bot ...

随机推荐

  1. tf.matmul函数和tf.multiply函数

    tf.matmul(a,b,transpose_a=False,transpose_b=False, adjoint_a=False, adjoint_b=False, a_is_sparse=Fal ...

  2. oracle 用函数返回对象集合

    1.先要声明全局type:并且,字段变量类型要为object,不能为record: (1)CREATE OR REPLACE TYPE "DDD_BY_DEPT_STATISTISC&quo ...

  3. javascript节点操作insertBefor()

    如果想要把节点放在某个特定的位置,而不是放在末尾,就可以使用insertBefore(a,b) 参数a:要插入的节点 参数b:作为参照的节点. var oDiv = document.getEleme ...

  4. iOS whose view is not in the window hierarchy!

    解决方法: viewController只Load完毕,没有Appear,此时应该将语句转移到ViewDidAppear方法中

  5. 朴素贝叶斯-对数似然Python实现-Numpy

    <Machine Learning in Action> 为防止连续乘法时每个乘数过小,而导致的下溢出(太多很小的数相乘结果为0,或者不能正确分类) 训练: def trainNB0(tr ...

  6. 【洛谷】P1341 无序字母对(欧拉回路)

    题目 传送门:QWQ 分析 快把欧拉回路忘光了. 欧拉回路大概就是一笔画的问题,可不可以一笔画完全图. 全图有欧拉回路当且仅当全图的奇数度数的点有0或2个. 2个时是一个点是起点,另一个是终点. 本题 ...

  7. 【Python编程:从入门到实践】chapter10 文件和异常

    chapter10 文件和异常 10.1 从文件中读取数据 10.1.1 读取整个文件 with open("pi.txt") as file_object: contents = ...

  8. json化的必要性

    参考文章:http://www.cnblogs.com/SanMaoSpace/p/3139186.html http://www.oschina.net/question/100267_61459

  9. SignalR (一)

    关于SignalR 因近期要在项目中使用 SignalR 来开发实时web 程序,可在这之前,对SignalR 的了解并不是很多,甚至不知道 SignalR 到底是用来干什么的,可是在经过这段时间的学 ...

  10. 从最大似然函数 到 EM算法详解

    极大似然算法 本来打算把别人讲的好的博文放在上面的,但是感觉那个适合看着玩,我看过之后感觉懂了,然后实际应用就不会了.... MLP其实就是用来求模型参数的,核心就是“模型已知,求取参数”,模型的意思 ...