题目:回文数字的判断
Determine whether an integer is a palindrome. Do this without extra space.Some hints:
Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to strin...
分类:
其他好文 时间:
2015-08-13 17:59:30
阅读次数:
129
思路:
1.如何判断一个链表是否是回文的?很简单将链表中的元素遍历出来并放进ArrayList中,然后可以像数组一样来判断该元素是否为回文的,时间复杂度O(n),空间复杂度O(n),可如何用O(n)的时间复杂度和O(1)的空间复杂度来解决呢?
2.是不是可以考虑 将链表反转?可反转后还是链表啊,要是将链表分为前后两个部分呢,分为两个部分还是无法判断该链表是否为回文链表啊,那要是再将其中一个链表反转一下呢,It's done!好多时候,多想一步容易,再多想一步就困难了。...
分类:
其他好文 时间:
2015-08-13 10:03:53
阅读次数:
117
Description: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?判断一个单向链表是不是回文。思路:最简单的思路就...
分类:
其他好文 时间:
2015-08-13 01:10:19
阅读次数:
116
Hrdv is interested in a string,especially the palindrome string.So he wants some palindrome string.A sequence of characters is a palindrome if it is t...
分类:
其他好文 时间:
2015-08-12 23:19:35
阅读次数:
111
DescriptionA 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...
分类:
其他好文 时间:
2015-08-12 21:33:11
阅读次数:
113
leetcode valid palindrome c++ & python solutions...
分类:
编程语言 时间:
2015-08-12 19:32:54
阅读次数:
118
【POJ 3974】 PalindromeManacher纯模板题 忘记的时候可以拿来找感觉代码如下:#include
#include
#include
#include using namespace std;char str[1111111];
char nwstr[2333333];
int p[2333333];...
分类:
其他好文 时间:
2015-08-12 14:41:00
阅读次数:
118
一、题目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?二、解析这个还是一个回文题目,是在做完回文数字后做的。这题要判断...
分类:
其他好文 时间:
2015-08-12 12:57:47
阅读次数:
193
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...
分类:
其他好文 时间:
2015-08-11 21:16:23
阅读次数:
114
G -回文串Time Limit:3000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionA palindrome is a symmetrical string, that is, a string...
分类:
其他好文 时间:
2015-08-11 21:15:44
阅读次数:
83