QuestionGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a can...
分类:
其他好文 时间:
2015-09-17 08:47:09
阅读次数:
168
【题目大意】给出一个字符串,可以删除或添加一些字符,它们各自会消耗价值。问最少消耗多少价值,可以使得字符串变成回文的。【思路】事实上删除或添加字符的价值只需要保持较小的那一个。假设当前要将(j,i)转换为回文字符,那么它有以下三种情况:(1)在结尾添加或删除一个和开头一样的字符,f[j][i-1]+...
分类:
其他好文 时间:
2015-09-17 00:54:24
阅读次数:
151
【题目】LeetCode(9): Palindrome NumberURL: https://leetcode.com/problems/palindrome-number/【描述】Determine whether an integer is a palindrome. Do this witho...
分类:
其他好文 时间:
2015-09-15 07:07:02
阅读次数:
189
Problem:Given a strings, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could ...
分类:
其他好文 时间:
2015-09-14 06:58:58
阅读次数:
198
题目来源:https://leetcode.com/problems/palindrome-number/题意分析: 这题是要判断一个int是否一个回文数,要求不能申请额外的空间。题目思路: 这题也是一个简单的题目,由于不能申请额外的空间,所以不能将int转换成string来处理。根据回文数的定义,...
分类:
编程语言 时间:
2015-09-11 19:14:00
阅读次数:
152
Determinewhetheranintegerisapalindrome.Dothiswithoutextraspace.Somehints:Couldnegativeintegersbepalindromes?(ie,-1)Ifyouarethinkingofconvertingtheintegertostring,notetherestrictionofusingextraspace.Youcouldalsotryreversinganinteger.However,ifyouhavesolvedth..
分类:
其他好文 时间:
2015-09-11 10:48:20
阅读次数:
182
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2015-09-10 20:56:00
阅读次数:
160
Problem:Given a string, determine if a permutation of the string could form a palindrome.For example,"code"-> False,"aab"-> True,"carerac"-> True.Gene...
分类:
其他好文 时间:
2015-09-10 08:25:51
阅读次数:
157
Question: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?Analysis:给出一个链表,能否在O(n)的时间和...
分类:
其他好文 时间:
2015-09-09 16:18:28
阅读次数:
132
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2015-09-09 06:20:00
阅读次数:
207