FASTEST | C++ | Beats 100% | 0ms | Easy-To-Understand
\n\n# Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n
\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool isRectangleOverlap(vector<int>& rect1, vector<int>& rect2) {\n        int fx1=rect1[0];\n        int fx2=rect1[2];\n        int fy1=rect1[1];\n        int fy2=rect1[3];\n\n        int sx1=rect2[0];\n        int sx2=rect2[2];\n        int sy1=rect2[1];\n        int sy2=rect2[3];\n\n        return !((sy1>=fy2) ||\n               (fy1>=sy2) ||\n               (fx1>=sx2) ||\n               (fx2<=sx1));\n    }\n};\n```
['C++']