587. Erect the Fence

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.

 

转载于:https://www.cnblogs.com/wdw828/p/6883938.html

这段代码是一个 Vue.js 的单文件组件,包含了一个模板 `<template>` 和组件的结构。 在模板中,组件的内容被包含在一个 `div` 标签中,而每个组件都被使用自定义标签的形式引入,例如 `<header-part />`、`<search />`、`<category />` 等等。这些自定义标签的实现在 Vue.js 的 JavaScript 代码中定义。 具体来说: - `<header-part />` 组件用于渲染页面的头部,包括网站的 logo、导航栏等等。 - `<search />` 组件用于渲染页面中的搜索栏。 - `<category />` 组件用于渲染商品分类列表。 - `<rotation />` 组件用于渲染轮播图,展示一些特别推荐的商品信息。 - `<erect-rotation />` 组件用于渲染竖向的轮播图,也是用于展示推荐商品信息的。 - `<serve />` 组件用于渲染页面中的服务列表。 - `<sec-kill />` 组件用于渲染秒杀商品列表。 - `<recommend />` 组件用于渲染推荐商品列表。 - `<my-footer />` 组件用于渲染页面的底部信息。 组件的实现代码应该在 JavaScript 中,通过 Vue.js 的组件定义方式来定义,例如: ```javascript Vue.component('header-part', { // 组件的选项 }) ``` 这样的组件定义方式需要在 Vue.js 的入口 JavaScript 文件中进行定义,然后才能在模板中使用。 总体来说,这段代码是一个典型的 Vue.js 单文件组件,用于构建京东商城页面的组件化。通过将页面拆分为多个组件,可以更加方便地管理和维护页面的代码,并且可以实现代码的重用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值