
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 a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and this subsequence should not be any subsequence of the other strings.
A subsequence is a sequence that can be derived from one sequence by deleting some characters without changing the order of the remaining elements. Trivially, any string is a subsequence of itself and an empty string is a subsequence of any string.
The input will be a list of strings, and the output needs to be the length of the longest uncommon subsequence. If the longest uncommon subsequence doesn't exist, return -1.
Example 1:
Note:
这道题是之前那道Longest Uncommon Subsequence I的拓展,那道题因为只有两个字符串为大家所不屑。那么这道题有多个字符串,这次大家满足了吧。令我吃惊的是,这次的OJ异常的大度,连暴力搜索的解法也让过,那么还等什么,无脑暴力破解吧。遍历所有的字符串,对于每个遍历到的字符串,再和所有的其他的字符串比较,看是不是某一个字符串的子序列,如果都不是的话,那么当前字符串就是一个非共同子序列,用其长度来更新结果res,参见代码如下:
解法一:
下面这种解法使用一些博主能想到的优化手段,首先我们给字符串按长度来排序,将长度大的放到前面,这样我们如果找到了非共同子序列,那么直接返回其长度即可,因为当前找到的肯定是最长的。然后我们用一个集合来记录已经遍历过的字符串,利用集合的去重复特性,这样在有大量的重复字符串的时候可以提高效率,然后我们开始遍历字符串,对于当前遍历到的字符串,我们和集合中的所有字符串相比,看其是否是某个的子序列,如果都不是,说明当前的就是最长的非共同子序列。注意如果当前的字符串是集合中某个字符串的子序列,那么直接break出来,不用再和其他的比较了,这样在集合中有大量的字符串时可以提高效率,最后别忘了将遍历过的字符串加入集合中,参见代码如下:
解法二:
类似题目:
Longest Uncommon Subsequence I
参考资料:
https://discuss.leetcode.com/topic/85033/checking-subsequence-without-hashing
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: