
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.
During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth team, which is a good strategy to make the contest more interesting. Now, you're given n teams, you need to output their final contest matches in the form of a string.
The n teams are given in the form of positive integers from 1 to n, which represents their initial rank. (Rank 1 is the strongest team and Rank n is the weakest team.) We'll use parentheses('(', ')') and commas(',') to represent the contest team pairing - parentheses('(' , ')') for pairing and commas(',') for partition. During the pairing process in each round, you always need to follow the strategy of making the rather strong one pair with the rather weak one.
Example 1:
Example 2:
Example 3:
Note:
这道题讲的是NBA的季后赛对战顺序,对于一个看了十几年NBA的老粉来说,再熟悉不过了。这种对战顺序是为了避免强强之间过早对决,从而失去比赛的公平性,跟欧冠欧联那种八强就开始随机抽签匹配有本质上的区别。NBA的这种比赛机制基本弱队很难翻身,假如你是拿到最后一张季后赛门票进的,那么一上来就干联盟第一,肯定凶多吉少,很有可能就被横扫了。但是偶尔也会出现黑八的情况,但都是极其少见的,毕竟像勇士这么叼的球队毕竟不多。好了,不闲扯了,来做题吧。我们就拿NBA这种八个球队的情况来分析吧,八只球队的排名是按常规赛胜率来排的:
1 2 3 4 5 6 7 8
因为是最强和最弱来对决,其次是次强与次弱对决,以此类推可得到:
1-8 2-7 3-6 4-5
那么接下来呢,还是最强与最弱,次强与次弱这种关系:
(1-8 4-5) (2-7 3-6)
最后胜者争夺冠军
((1-8 4-5) (2-7 3-6))
这样一分析是不是就清楚了呢,由于n限定了是2的次方数,那么就是可以一直对半分的,比如开始有n队,第一拆分为n/2对匹配,然后再对半拆,就是n/2/2,直到拆到n为1停止,而且每次都是首与末配对,次首与次末配对,这样搞清楚了规律,代码应该就不难写了吧,参见代码如下:
解法一:
下面这种方法是递归的写法,解题思路跟上面没有区别,参见代码如下:
解法二:
参考资料:
https://discuss.leetcode.com/topic/83454/java-10-lines/2
https://discuss.leetcode.com/topic/83457/c-java-clean-code
https://discuss.leetcode.com/topic/83460/java-recursive-solution
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: