【LeetCode】 223. Rectangle Area
来源:互联网 发布:随机算法软件 编辑:程序博客网 时间:2024/05/23 11:14
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Assume that the total area is never beyond the maximum possible value of int.
public class Solution { public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int left = Math.max(A, E); int right = Math.max(Math.min(C, G), left); int down = Math.max(B, F); int up = Math.max(Math.min(D, H), down); return (C - A) * (D - B) + (G - E) * (H - F) - (right - left) * (up - down); }}
0 0
- [leetcode] 223.Rectangle Area
- [leetcode] 223. Rectangle Area
- 223. Rectangle Area LeetCode
- #leetcode# 223. Rectangle Area
- leetcode 223. Rectangle Area
- LeetCode--223. Rectangle Area
- LeetCode *** 223. Rectangle Area
- LeetCode 223. Rectangle Area
- leetcode-223. Rectangle Area
- LeetCode-223.Rectangle Area
- 223.[Leetcode]Rectangle Area
- leetcode 223. Rectangle Area
- 【leetcode】223. Rectangle Area
- [Leetcode]223. Rectangle Area
- LeetCode - 223. Rectangle Area
- LeetCode 223. Rectangle Area
- LeetCode 223. Rectangle Area
- LeetCode 223. Rectangle Area
- hello world! 喔,好吧。。。我是程序员
- 【03】 linux 终端下高亮输出perl
- ubuntu安装eclipse
- qweweqr
- 条件运算符?优先级
- 【LeetCode】 223. Rectangle Area
- win版git的安装及获取源码踩过的坑(超清晰)
- 【LeetCode】 225. Implement Stack using Queues
- 基础1
- 【LeetCode】 226. Invert Binary Tree
- s*s*-libev配置多端口的最优方法
- 【LeetCode】 231. Power of Two
- 手机抓取数据学习笔记
- Git使用积累