Title: #223 - Rectangle Area - LeetCode JavaScript Solutions
Open Graph Title: #223 - Rectangle Area - LeetCode JavaScript Solutions
X Title: #223 - Rectangle Area - LeetCode JavaScript Solutions
Description: Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle ...
Open Graph Description: Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle ...
X Description: Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle ...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/rectangle-area
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/rectangle-area","name":"#223 - Rectangle Area - LeetCode JavaScript Solutions","description":"Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle ...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number} ax1\n * @param {number} ay1\n * @param {number} ax2\n * @param {number} ay2\n * @param {number} bx1\n * @param {number} by1\n * @param {number} bx2\n * @param {number} by2\n * @return {number}\n */\nvar computeArea = function(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n return (ax2 - ax1) * (ay2 - ay1) + (bx2 - bx1) * (by2 - by1)\n - Math.max(0, Math.min(ax2, bx2) - Math.max(ax1, bx1))\n * Math.max(0, Math.min(ay2, by2) - Math.max(ay1, by1));\n};","keywords":"LeetCode 223, #223 - Rectangle Area, Medium, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/rectangle-area |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/rectangle-area/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0223-rectangle-area.js |
| Math | https://leetcodejavascript.com/tags/math |
| Geometry | https://leetcodejavascript.com/tags/geometry |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow