码迷,mamicode.com
首页 >  
搜索关键字:palindrome    ( 1561个结果
leetcode 9.Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.Notes:1) Negative number is notpalindrome.2) Compare from head to tail, cons...
分类:其他好文   时间:2014-11-08 16:43:57    阅读次数:124
HDU 1513
HDU1513 Palindrome...
分类:其他好文   时间:2014-11-08 15:16:25    阅读次数:152
UVA 11584 Quick access, info and search.
Problem H: Partitioning by Palindromes We say a sequence of characters is a palindrome if it is the same written forwards and backwards. For example, 'racecar' is a palindrome, but 'fastcar' is not...
分类:数据库   时间:2014-11-08 15:16:07    阅读次数:150
LeetCode OJ Palindrome Number(回文数)
1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 int r=0,init=x; 5 if(init==0) return true; 6 if(init<0) ...
分类:其他好文   时间:2014-11-07 14:21:40    阅读次数:162
[LeetCode]Palindrome Number 判断二进制和十进制是否为回文
class Solution { public: bool isPalindrome2(int x) {//二进制 int num=1,len=1,t=x>>1; while(t){ num<>=1; len++; } len/=2; while(len--){ if((num&x==0)&&(x&1)!=0){ re...
分类:其他好文   时间:2014-11-06 17:39:21    阅读次数:333
Valid Palindrome
一开始非常天真的利用2次for循环,依次剔除其中的非英文字符,一次用来比较,但是后来显示超时,没办法,只能把两次合并为一次。qishifdsfd。其实我是最厌恶这种题目的,要求不清,你以为有效字符只是英文字母,结果运行一遍才发现竟然还有数字,只能接着改。ac的代码:public class Solu...
分类:其他好文   时间:2014-11-05 22:45:32    阅读次数:241
LeetCode:Palindrome Number
题目描述: Determine whether an integer is a palindrome. Do this without extra space. 代码: bool Solution::isPalindrome(int x) { int a = x; int b = 0; while(a > 0) { b = b * ...
分类:其他好文   时间:2014-11-05 21:35:26    阅读次数:167
LeetCode:Valid Palindrome
题目描述: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car...
分类:其他好文   时间:2014-11-05 21:30:46    阅读次数:160
【LeetCode】Valid Palindrome
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla...
分类:其他好文   时间:2014-11-05 21:22:45    阅读次数:130
[Leetcode]Palindrome Partitioning
[解题思路] 由于要求列出所有的可能,直接上dfs [代码] class Solution { public: vector > res; vector> partition(string s) { vector partitions; dfs(partitions, s, 0); retur...
分类:其他好文   时间:2014-11-05 17:13:06    阅读次数:147
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!