Leetcode 223 Rectangle Area
2015-06-12 10:24
218 查看
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.
两矩形面积相加后减去重叠部分
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.
两矩形面积相加后减去重叠部分
def compute_area(a, b, c, d, e, f, g, h) (c-a) * (d-b) + (g-e) * (h-f) - [([c,g].min-[a,e].max),0].max * [([d,h].min-[b,f].max),0].max end
相关文章推荐
- 域名
- 大数据_小数据01
- 实习生培训之ROSE+JADE
- quick cocos2dx lua 网络图片 下载 自动更新
- 【BZOJ】【1419】Red is good
- LeetCode | Plus One
- 栈溢出崩溃排查(二)
- Qt下libusb-win32的使用方法(转)
- Android程序崩溃统一处理机制
- ExtJs 入门教程
- 朝鲜创新操作系统:“红星Linux 3.0” 满满的苹果味
- android性能
- android客户端 与javaweb服务端的简单理解
- 实习生培训之Java环境搭建
- 随机生成6位验证码或密码(字母和数字组合)
- UVA1407
- ios6、7 版本适配
- Redis3.0集群部署文档(centos系统)
- sgu223
- js中substr和substring两个方法的区别