今際の国の呵呵君
Sunday, September 24, 2017
[LeetCode]Longest Palindrome
每有一对字符就可以让palindrome长度加2,最后看还有没有剩余的字符,有就加1即可,因为回文最多允许一个数量为奇数的字符。O(n)时间空间,代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment