码迷,mamicode.com
首页 >  
搜索关键字:palindrome    ( 1561个结果
hdu_5146
1 #include "cstdio" 2 3 #define MaxN 1111 4 #define ACCEPT 5 6 bool is_palindrome; 7 int case_num, n, arr[MaxN]; 8 long long even_sum, odd_sum; 9 1...
分类:其他好文   时间:2014-12-28 22:07:17    阅读次数:241
【leetcode】Palindrome Partitioning
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:其他好文   时间:2014-12-28 00:23:59    阅读次数:180
leetcode:Valid Palindrome
一、     题目 题目给出一个字符串,求出它是否为回文字符串,其中只有字母和数字是有效字符,其他的字符可以忽略。 例如:"Aman, a plan, a canal: Panama" 是回文字符串. "race a car" is not a palindrome.不是回文字符串 二、     分析 看到这个题目我首先想到的是使用两个数组将有效字符串保存,其中一个正序一个逆序,然后做比...
分类:其他好文   时间:2014-12-26 21:44:07    阅读次数:152
Palindrome Partitioning
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:其他好文   时间:2014-12-24 21:22:09    阅读次数:184
LeetCode Problem 9:Palindrome Number回文数
描述:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thi...
分类:其他好文   时间:2014-12-24 19:57:39    阅读次数:127
Leetcode Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.对于这道题不能用额外的空间,即不能用一个数组来保存各个位数,因此对于这种问题可以采用判断两头数字的方法 1 package Palindrome.Num...
分类:其他好文   时间:2014-12-22 22:42:10    阅读次数:167
【LeetCode】Palindrome Number
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers b...
分类:其他好文   时间:2014-12-21 22:00:15    阅读次数:131
Palindrome Number(回文串)
题目: Determine whether an integer is a palindrome. Do this without extra space. 分析: 该题目来源于leetcode。回文串是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。当然整数形式的回文串也是类似的。但负数不是回文串。两种思路: 按定义来,依次比较串的首尾,直到中...
分类:其他好文   时间:2014-12-21 20:43:45    阅读次数:174
HDU 1513 Palindrome【LCS】
题意:给出一个字符串s,问至少加入多少个字母让它变成回文串解题思路:求出该字符串与该字符串翻转后的最长公共子序列的长度,再用该字符串的长度减去最长公共子序列的长度即为所求反思:因为题目所给的n的范围为3#includechar s[5005],w[5005];int dp[2][5005];int ...
分类:其他好文   时间:2014-12-21 08:08:52    阅读次数:185
LeetCode--Palindrome Number
题目的意思是判断数字是否为回文。本文用了两种方法,一种效率稍高,但代码稍稍多几行;一种代码稍少,但效率稍稍低点。 题目: 我的第一种解决方案: public class Solution { public boolean isPalindrome(int x) { boolean is=true; if(x>=0){ /...
分类:其他好文   时间:2014-12-19 23:28:32    阅读次数:159
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!