
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 string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
This is case sensitive, for example
"Aa"
is not considered a palindrome here.Note:
Assume the length of given string will not exceed 1,010.
Example:
这又是一道关于回文字符串的问题,LeetCode上关于回文串的题有十来道呢,也算一个比较重要的知识点。但是这道题确实不算一道难题,给了我们一个字符串,让我们找出可以组成的最长的回文串的长度,由于字符顺序可以打乱,所以问题就转化为了求偶数个字符的个数,我们了解回文串的都知道,回文串主要有两种形式,一个是左右完全对称的,比如noon, 还有一种是以中间字符为中心,左右对称,比如bob,level等,那么我们统计出来所有偶数个字符的出现总和,然后如果有奇数个字符的话,我们取取出其最大偶数,然后最后结果加1即可,参见代码如下:
解法一:
上面那种方法是通过哈希表来建立字符串和其出现次数的映射,这里我们可以换一种思路,来找出搜有奇数个的字符,我们采用的方法是使用一个set集合,如果遍历到的字符不在set中,那么就将其加入set,如果已经在set里了,就将其从set中删去,这样遍历完成后set中就是所有出现个数是奇数个的字符了,那么我们最后只要用s的长度减去0和set长度减一之间的较大值即可,为啥这样呢,我们想,如果没有出现个数是奇数个的字符,那么t的长度就是0,减1成了-1,那么s的长度只要减去0即可;如果有奇数个的字符,那么字符个数减1,就是不能组成回文串的字符,因为回文串最多允许一个不成对出现的字符,参见代码如下:
解法二:
最后这种方法利用到了STL中的count函数,就是找字符串中某个字符出现的个数,那么我们和1相与,就可以知道该个数是奇数还是偶数了,返回的写法和上面那种方法相同,参见代码如下:
解法三:
类似题目:
Palindrome Pairs
Palindrome Permutation II
Palindrome Permutation
Palindrome Linked List
Shortest Palindrome
Palindrome Partitioning II
Palindrome Partitioning
Valid Palindrome
Palindrome Number
Longest Palindromic Substring
参考资料:
https://discuss.leetcode.com/topic/61338/what-are-the-odds-python-c
https://discuss.leetcode.com/topic/61574/very-easy-to-understand-java-solution
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: