题目链接:http://poj.org/problem?id=3974DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the s...
分类:
其他好文 时间:
2015-08-29 16:41:37
阅读次数:
193
Determine whether an integer is a palindrome. Do this without extra space.class Solution { public: bool isPalindrome(int x) { if (x...
分类:
其他好文 时间:
2015-08-28 12:52:10
阅读次数:
158
Palindromic Numbers
Time Limit: 2000MS Memory Limit: 32768KB 64bit IO Format: %lld & %lluSubmit StatusDescriptionA palindromic number or numeral palindrome is a ‘symmetrical’ number like 16...
分类:
其他好文 时间:
2015-08-28 11:08:14
阅读次数:
212
PalindromeTime Limit:3000MSMemory Limit:65536KTotal Submissions:56756Accepted:19631DescriptionA palindrome is a symmetrical string, that is, a string ...
分类:
其他好文 时间:
2015-08-27 14:55:04
阅读次数:
176
题目:Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space?碉堡!reference:http://www.cnblogs...
分类:
其他好文 时间:
2015-08-27 14:47:02
阅读次数:
149
POJ 3280 Cheapest Palindrome字串S长M,由N个小写字母构成。欲通过增删字母将其变为回文串,增删特定字母花费不同,求最小花费。思路:1.先对普遍情况进行讨论 ,即不管内部是否回文的花费 :dp[i][j]=min(dp[i+1][j]+cost[s[i]-'a'],dp[i...
分类:
其他好文 时间:
2015-08-26 20:07:41
阅读次数:
161
判断单链表是否为回文;思想:利用来两个指针找到链表中点,将后半个链表反转。然后判断。有个问题,下面的代码没有恢复原来的单链表。 1 class Solution { 2 public: 3 bool isPalindrome(ListNode* head) { 4 ListN...
分类:
其他好文 时间:
2015-08-25 23:06:44
阅读次数:
180
Description
A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the...
分类:
其他好文 时间:
2015-08-25 12:02:34
阅读次数:
230
Just check there are no more than 2 characters that appear an odd number of times in the string.My C++ code using an array as a hash map is as follows...
分类:
其他好文 时间:
2015-08-21 19:21:54
阅读次数:
439
Palindrome
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4194 Accepted Submission(s): 1427
Problem Description
A palindrome is...
分类:
其他好文 时间:
2015-08-21 13:43:45
阅读次数:
178