Problem statement:

There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the minimum length of rope as it is expensive. The garden is well fenced only if all the trees are enclosed. Your task is to help find the coordinates of trees which are exactly located on the fence perimeter.

Example 1:

Input: [[1,1],[2,2],[2,0],[2,4],[3,3],[4,2]]
Output: [[1,1],[2,0],[4,2],[3,3],[2,4]]
Explanation:

Example 2:

Input: [[1,2],[2,2],[4,2]]
Output: [[1,2],[2,2],[4,2]]
Explanation:

Even you only have trees in a line, you need to use rope to enclose them.

Note:

  1. All trees should be enclosed together. You cannot cut the rope to enclose trees that will separate them in more than one group.
  2. All input integers will range from 0 to 100.
  3. The garden has at least one tree.
  4. All coordinates are distinct.
  5. Input points have NO order. No order required for output.

Solution:

This problem is the last question of leetcode weekly contest 32. It is pure math.

最新文章

  1. IBM Bluemix体验:Containers持久存储
  2. asp.net MVC 自动下载apk
  3. 与众不同 windows phone (49) - 8.1 新增控件: 概述, ContentDialog, MapControl
  4. 编程之美2.5:寻找最大的K个数
  5. sdut 2153 Clockwise (2010年山东省第一届ACM大学生程序设计竞赛)
  6. RegisterStartupScript和RegisterClientScriptBlock的用法
  7. Unity NGUI实现按钮点击播放Aniamtion
  8. hibernate连接数据库,进行操作的步骤
  9. jQuery $.fn.extend方式自定义插件
  10. 基于ffmpeg的C++播放器1
  11. 刀片服务器和磁盘阵列卡(RAID)技术---永和维护
  12. hystrix学习
  13. k8s(4)-使用服务公开应用程序
  14. mac OS配置用户全局环境变量(设置字符集为UTF8)
  15. Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem F. Turning Grille 暴力
  16. net自定义安装程序快捷方式
  17. msgpack配合FIREDAC传输多表数据
  18. 正则,String中用法,Pattern Matcher
  19. Python 字典(Dictionary) update()方法
  20. [VB6.0-->VB.NET]关于VB6.0升级到VB.NET的微软官方文档

热门文章

  1. magento 获得当前产品页面的产品id
  2. java批处理、MySQL批处理
  3. 12c pdb expdp use DATA_PUMP_DIR meet ORA-39145
  4. 【LeetCode 33】Search in Rotated Sorted Array
  5. AJPFX:递归与非递归之间的转化
  6. [BZOJ1046][HAOI2007]上升序列 DP+贪心
  7. Spring---AOP注解开发&jdbc模板&Spring事务管理
  8. 鸢尾花数据集-iris.data
  9. IIS ARR(Application Request Route)与反向代理(Reverse Proxy)
  10. vim设置默认显示行号