9 Palindrome Number链接: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 negat...
分类:
其他好文 时间:
2015-07-01 18:26:10
阅读次数:
111
Determine whether an integer is a palindrome. Do this without extra space.
题目:判断int数据是否为回文数
注意:负数不是回文数,0是最小的回文数
思路:此题和前面一道 求int数的反序差不多http://blog.csdn.net/xiabodan/article/details/46674133...
分类:
其他好文 时间:
2015-07-01 18:22:52
阅读次数:
154
题意简述给定一个字符串(长度不超过5000 且只包含a、b)求满足如下所示的半回文子串中字典序第k大的子串ti?=?t|t|?-?i?+?1(|t|为字符串长度)) -------------------------------------------------------------------...
分类:
其他好文 时间:
2015-07-01 13:50:37
阅读次数:
160
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2015-06-30 12:47:25
阅读次数:
82
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:
Could negative integers be palindromes? (ie, -1)If you are thinking of converting the inte...
分类:
其他好文 时间:
2015-06-28 21:42:54
阅读次数:
133
1 class Solution { 2 public: 3 /** 4 * @param s A string 5 * @return Whether the string is a valid palindrome 6 */ 7 bool isPa...
分类:
其他好文 时间:
2015-06-28 16:46:14
阅读次数:
298
1. Question确定一个数是否是回文数。要求不使用额外空间。Determine whether an integer is a palindrome. Do this without extra space.2. Solution如果是负数,就不是回文数。2.1 reverse integer...
分类:
其他好文 时间:
2015-06-23 23:04:49
阅读次数:
132
题目:判断一个数是不是回文数Determine whether an integer is a palindrome. Do this without extra space.思路:借助上一道求整数逆序的思路,判断逆序后的数和原数是否相等就行。要注意,负数都不是回文数11506 / 11506 te...
分类:
其他好文 时间:
2015-06-23 19:48:42
阅读次数:
111
题目:给你一个字符串,可以进行增删改三种操作,问变成回文串最少的操作次数。
分析:动态规划,dp,LCS。可以利用区间dp求解,这里利用LCS求解更快。
利用字符串和自己的翻转求最大公共子序列,然后枚举所有的dp[i][len-i],
找最小的即可。注意可能最小值在dp[i-1][len-i],即str[i]为中间元素,不用匹配。
说明:注意...
分类:
其他好文 时间:
2015-06-23 15:38:53
阅读次数:
77
#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