
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.
The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.
This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.
Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.
The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.
Given an array
A
of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths.If it is impossible to form any triangle of non-zero area, return
0
.Example 1:
Example 2:
Example 3:
Example 4:
Note:
3 <= A.length <= 10000
1 <= A[i] <= 10^6
这道题给了个正整数数组,让从中选三个数当作三角形的三条边,问能组成的三角形的最大周长是多少。因为要组成三角形,所以必须要满足两边之和大于第三边这一条性质,我们并不用去检测所有的组合情况,而是只要判断较短的两边之和是否大于最长的那条边就可以了。虽然这道是 Easy 题目,但是 OJ 仍然不让用暴力搜索法,遍历任意三条边是会超时的。所以只能想优化的解法,既然要周长最长,则肯定是选较大的数字先测比较好。这里就先给数组排个序,然后从末尾开始,每次取出三个数字,先检测能否组成三角形,可以的话直接返回周长,不行的话就继续往前取,若都不行的话,就返回0,参见代码如下:
Github 同步地址:
#976
类似题目:
Largest Triangle Area
参考资料:
https://leetcode.com/problems/largest-perimeter-triangle/
https://leetcode.com/problems/largest-perimeter-triangle/discuss/217972/C%2B%2B-4-lines-O(n-log-n)
https://leetcode.com/problems/largest-perimeter-triangle/discuss/217988/JavaC%2B%2BPython-Sort-and-Try-Biggest
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: