
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 of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not be available for the next player. This continues until all the scores have been chosen. The player with the maximum score wins.
Given an array of scores, predict whether player 1 is the winner. You can assume each player plays to maximize his score.
Example 1:
Example 2:
Note:
这道题给了一个小游戏,有一个数组,两个玩家轮流取数,说明了只能从开头或结尾取,问我们第一个玩家能赢吗。这道题博主想到了应该是用 Minimax 来做,由于之前有过一道这样的题 Guess Number Higher or Lower II,所以依稀记得应该要用递归的方法,而且当前玩家赢返回 true 的条件就是递归调用下一个玩家输返回 false。这里需要一个变量来标记当前是第几个玩家,还需要两个变量来分别记录两个玩家的当前数字和,在递归函数里面,如果当前数组为空了,直接比较两个玩家的当前得分即可,如果数组中只有一个数字了,根据玩家标识来将这个数字加给某个玩家并进行比较总得分。如果数组有多个数字,分别生成两个新数组,一个是去掉首元素,一个是去掉尾元素,然后根据玩家标识分别调用不同的递归,只要下一个玩家两种情况中任意一种返回 false 了,那么当前玩家就可以赢了,参见代码如下:
解法一:
我们还可以使用 DP 加 Minimax 的方法来做,先来看递归的写法,十分的简洁。DP 数组的作用是保存中间结果,再次遇到相同情况时直接返回不用再次计算,提高了运算效率:
解法二:
下面这种方法是 DP 加 Minimax 的迭代写法,要注意的是 DP 的更新顺序,跟以往不太一样,这种更新方法是按区间来更新的,感觉之前好像没有遇到过这种更新的方法,还蛮特别的:
解法三:
Github 同步地址:
#486
类似题目:
Guess Number Higher or Lower II
参考资料:
https://leetcode.com/problems/predict-the-winner/
https://leetcode.com/problems/predict-the-winner/discuss/96832/C%2B%2B-DP-solution-with-explanation
https://leetcode.com/problems/predict-the-winner/discuss/96838/Java-'1-Line'-Recursive-Solution-O(n2)-Time-and-O(n)-Space
https://leetcode.com/problems/predict-the-winner/discuss/96828/JAVA-9-lines-DP-solution-easy-to-understand-with-improvement-to-O(N)-space-complexity.
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: