Download Rectangle Overlap.py
class Solution(object): def isRectangleOverlap(self, rec1, rec2): """ :type rec1: List[int] :type rec2: List[int] :rtype: bool """ return not (rec1 <= rec2 or # left rec1 <= rec2 or # bottom rec1 >= rec2 or # right rec1 >= rec2) # top # def isRectangleOverlap(self, rec1, rec2): # def intersect(p_left, p_right, q_left, q_right): # return min(p_right, q_right) > max(p_left, q_left) # return (intersect(rec1, rec1, rec2, rec2) and # intersect(rec1, rec1, rec2, rec2))
Leetcode 836 Rectangle Overlap problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.