Problem: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those lett ...
分类:
其他好文 时间:
2016-12-16 07:54:48
阅读次数:
110
freecodecamp 初级算法地址戳这里 Reverse a String 翻转字符串 Factorialize a Number 计算一个整数的阶乘 Check for Palindromes 如果给定的字符串是回文,返回true,反之,返回false。 Find the Longest Wo ...
分类:
编程语言 时间:
2016-12-05 16:46:14
阅读次数:
374
题解: 最先想到的是区间dp。。。但是n的范围是到1000,超时 后来看了题解。发现用一维DP即可 dp[j]表示从1到j组成的最小回文字符串个数 dp[j] = min( dp[i] + 1 ) s[i + 1 ,j]为回文字符串 代码: ...
分类:
其他好文 时间:
2016-12-02 07:40:54
阅读次数:
183
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... ...
分类:
其他好文 时间:
2016-11-29 14:49:41
阅读次数:
193
如果给定的字符串是回文,返回true,反之,返回false。 如果一个字符串忽略标点符号、大小写和空格,正着读和反着读一模一样,那么这个字符串就是palindrome(回文)。 注意你需要去掉字符串多余的标点符号和空格,然后把字符串转化成小写来验证此字符串是否为回文。 正则的使用,字符串和数组的转换 ...
分类:
其他好文 时间:
2016-10-27 01:15:51
阅读次数:
154
题意:输出第n(1 <= n <= 10^100000)大的偶数长度的回文数。(最小的为11) 因为长度是偶数,所以前后两半之间是相互对称的,又因为一个数字的大小主要取决于较高位数的大小,所以数字的前一半决定数的大小,从1开始,1,2,3……对称即可得11,22,33…… 所以将数正着输出后再倒着输 ...
分类:
其他好文 时间:
2016-10-25 14:17:36
阅读次数:
129
输入格式:首先一个整型,然后循环不带空格未知长度的字符串。 思考:首先用scanf_s()输入整型,然后一个大循环,用gets_s()函数输入字符串。 注意:scanf_s()多加了一个%c,&d,所以大循环前不用getchar()函数。 ...
分类:
其他好文 时间:
2016-10-23 03:01:16
阅读次数:
233
UVA - 11584 Partitioning by Palindromes We say a sequence of char- acters is a palindrome if it is the same written forwards and backwards. For exampl ...
分类:
其他好文 时间:
2016-10-19 02:47:18
阅读次数:
169
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This ...
分类:
其他好文 时间:
2016-10-16 07:49:39
阅读次数:
197
A palindrome is a string that reads the same from the left as it does from the right. For example, I, GAG and MADAM are palindromes, but ADAM is not. ...
分类:
其他好文 时间:
2016-10-07 20:43:22
阅读次数:
161