#6 ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like
this: (you may want to display this pattern in a fixed font for better legibility)...
分类:
其他好文 时间:
2015-06-22 22:25:11
阅读次数:
181
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:
其他好文 时间:
2015-06-22 20:38:42
阅读次数:
156
题意:给定一个字符序列,求最少添加多少个字符能让它变成对称序列
分析:这题的做法竟然是把序列颠倒之后求最长公共子序列,然后n-dp[n][n]就是答案。记住这种做法。
在这里再说一次最长公共子序列的做法:dp[i][j]表示序列1的前i个字符和序列2的前j个字符比较时的最长公共子序列的长度,状态转移公式:1.当a[i]==b[j]时,dp[i][j]=dp[i-1][j-1]...
分类:
其他好文 时间:
2015-06-21 21:11:44
阅读次数:
123
Valid Palindrome : https://leetcode.com/problems/valid-palindrome/Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,
“A man, a pl...
分类:
其他好文 时间:
2015-06-21 18:34:26
阅读次数:
110
Description:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a...
分类:
其他好文 时间:
2015-06-21 17:14:49
阅读次数:
93
题目链接:https://leetcode.com/problems/palindrome-number/
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative inte...
分类:
其他好文 时间:
2015-06-21 15:52:27
阅读次数:
145
Determine whether an integer is a palindrome. Do this without extra space.利用余数构造倒置数再判断。var isPalindrome = function(x) { var y = 0 var t = x w...
分类:
其他好文 时间:
2015-06-20 23:30:33
阅读次数:
317
这里,我介绍一下O(n)回文串处理的一种方法。Manacher算法.原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-palindrome-sub....
分类:
编程语言 时间:
2015-06-20 13:08:23
阅读次数:
192
Description:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, "A man, a plan, ...
分类:
其他好文 时间:
2015-06-19 22:59:13
阅读次数:
165
题目:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you ca...
分类:
编程语言 时间:
2015-06-18 23:42:31
阅读次数:
198