码迷,mamicode.com
首页 >  
搜索关键字:palindrome    ( 1561个结果
234. 回文链表 Palindrome Linked List
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?判断一个链表是否为回文串思路:1.找到中间点,2.反转后半部分链表,3.... ...
分类:其他好文   时间:2017-04-01 23:46:32    阅读次数:223
9. Palindrome Number【数学】
2017/3/30 21:49:57Determine whether an integer is a palindrome. Do this without extra space.版本1:要求不能用额外空间说明不能建立数组存每个数字,只能依靠运算符。1、需要额外考虑负数情况;2、从两边开始取出数... ...
分类:其他好文   时间:2017-03-30 22:45:43    阅读次数:113
回文(未完成)
// zuichanghuiwen.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; void palindrome(string str) { stack sta;... ...
分类:其他好文   时间:2017-03-29 01:20:47    阅读次数:146
125. Valid Palindrome【双指针】
2017/3/15 21:47:04 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a ...
分类:其他好文   时间:2017-03-27 00:28:56    阅读次数:240
409. Longest Palindrome
题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. ...
分类:其他好文   时间:2017-03-24 10:32:02    阅读次数:125
POJ 3280 Cheapest Palindrome (区间DP)
题意:字串S长M,由N个小写字母构成。欲通过增删字母将其变为回文串,增删特定字母花费不同,求最小花费。 析:是一个简单DP,dp[i][j] 表示区间 i - j 是回文串的最小花费,很容易知道,删除和添加效果是一样的,所以我们就可以只取一个最小值就好。 做的时候我的初始化在外面,就一直WA。 代码 ...
分类:其他好文   时间:2017-03-20 18:44:56    阅读次数:206
poj3280 Cheapest Palindrome
思路: 区间dp。添加和删除本质相同。 实现: ...
分类:其他好文   时间:2017-03-18 22:57:40    阅读次数:198
Python 内建的filter()函数用于过滤序列。
例如,在一个list中,删掉偶数,只保留奇数,可以这么写: # -*- coding: utf-8 -*-from functools import reduce def is_palindrome(n): lenN=len(str(n)) #print(lenN) n=str(n) #print( ...
分类:编程语言   时间:2017-03-14 17:29:22    阅读次数:246
zoj 2744 Palindromes
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome becau ...
分类:其他好文   时间:2017-03-10 13:12:58    阅读次数:270
palindrome-number
//判断数组是否是回文 不能用字符串作为辅助,也不能翻转数字(有溢出情况); ...
分类:其他好文   时间:2017-03-07 08:54:27    阅读次数:118
1561条   上一页 1 ... 51 52 53 54 55 ... 157 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!