码迷,mamicode.com
首页 > 其他好文 > 详细

[LeetCode] Convex Polygon 凸多边形

时间:2016-12-08 23:51:50      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:join   分享   nts   problems   alt   ems   技术   org   ima   

 

Given a list of points that form a polygon when joined sequentially, find if this polygon is convex (Convex polygon definition).

Note:

  1. There are at least 3 and at most 10,000 points.
  2. Coordinates are in the range -10,000 to 10,000.
  3. You may assume the polygon formed by given points is always a simple polygon (Simple polygon definition). In other words, we ensure that exactly two edges intersect at each vertex, and that edges otherwise don‘t intersect each other.

Example 1:

[[0,0],[0,1],[1,1],[1,0]]

Answer: True

Explanation:

技术分享

Example 2:

[[0,0],[0,10],[10,10],[10,0],[5,5]]

Answer: False

Explanation:

技术分享

 

s

 

[LeetCode] Convex Polygon 凸多边形

标签:join   分享   nts   problems   alt   ems   技术   org   ima   

原文地址:http://www.cnblogs.com/grandyang/p/6146986.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!