Cheapest Palindrome Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8643 Accepted: 4189 Description Keeping track of all the cows can be a ...
分类:
其他好文 时间:
2016-09-14 12:33:47
阅读次数:
156
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? 先用2 pointer查找到中间点,然后后半部分reverse, 最 ...
分类:
其他好文 时间:
2016-09-13 13:23:48
阅读次数:
108
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e.words[i] + ...
分类:
其他好文 时间:
2016-09-12 12:19:16
阅读次数:
107
Determine whether an integer is a palindrome. Do this without extra space. Solution1: 思路:按题目的意思就是负数不能是palindrome。用reverse integer函数判断即可。 ...
分类:
其他好文 时间:
2016-09-12 06:13:38
阅读次数:
112
题目: Determine whether an integer is a palindrome. Do this without extra space. 简单题。看到两个比较好的解法,一个是把数字转化为字符串,然后首尾对比,往中间靠。另一种是数字分别从两头求和(保留位数:*10 + 余数),如果 ...
分类:
其他好文 时间:
2016-09-10 11:37:32
阅读次数:
108
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? if use space O(1), we need to use ...
分类:
其他好文 时间:
2016-09-08 23:18:35
阅读次数:
181
1. 问题描述 Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you ar ...
分类:
其他好文 时间:
2016-09-08 00:58:57
阅读次数:
224
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan ...
分类:
其他好文 时间:
2016-09-04 17:21:02
阅读次数:
109
Given a singly linked list, determine if it is a palindrome. 思路: 回文结构从后向前遍历与从前向后遍历的结果是相同的,可以利用一个栈的结构,将出栈元素与正向移动的指针指向元素比较,即可判断。 解法: ...
分类:
其他好文 时间:
2016-09-04 01:32:43
阅读次数:
137