码迷,mamicode.com
首页 >  
搜索关键字:palindrome    ( 1561个结果
Palindrome-Number(判断回文数字)
判断一个数是否为回文数字,如1,2,3,121,1001,999都是回文数字,10,9898就不是回文数字。 解法:判断对称中心两端数字是否相同。 代码如下: bool isPalindrome(int x) { if (x<0 || (x != 0 && x % 10 == 0)) return ...
分类:其他好文   时间:2017-06-10 12:15:30    阅读次数:153
palindrome-partitioning I&II——回文切割、深度遍历
I: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For exa ...
分类:其他好文   时间:2017-06-09 19:24:32    阅读次数:249
[leetcode] Palindrome Number(不使用额外空间)
本来推断回文串是一件非常easy的事情,仅仅须要反转字符串后在与原字符串相比較就可以。这道题目明白说明不能使用额外的空间。那么使用将其分解连接成字符串的方法便不是可行的。仅仅好採用数学的方式: 每次取最高位和最低位相比較,总的位数能够用一个while先处理出来,循环直至取余和除数相等。 详细见代码: ...
分类:其他好文   时间:2017-06-09 14:10:57    阅读次数:133
Palindrome Linked List Leetcode
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? 这个follow up要求O(n)的时间和O(1)的空间,可以先re ...
分类:其他好文   时间:2017-06-07 23:21:04    阅读次数:274
125. Valid Palindrome
https://leetcode.com/problems/valid-palindrome/#/description Given a string, determine if it is a palindrome, considering only alphanumeric characters ...
分类:其他好文   时间:2017-06-05 22:09:10    阅读次数:170
leetcode题解||Palindrome Number问题
problem: Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be pal ...
分类:其他好文   时间:2017-06-04 22:40:30    阅读次数:223
[LeetCode][Java] Palindrome Number
题目: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are ...
分类:编程语言   时间:2017-06-04 15:38:18    阅读次数:252
9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi ...
分类:其他好文   时间:2017-06-04 10:51:59    阅读次数:138
POJ 3280 Cheapest Palindrome(区间DP)
Cheapest Palindrome Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 6861 Accepted: 3327 Description Keeping track of all the cows can be a ...
分类:其他好文   时间:2017-06-03 19:24:52    阅读次数:232
POJ 3280 Cheapest Palindrome DP题解
看到Palindrome的题目。首先想到的应该是中心问题,然后从中心出发,思考怎样解决。 DP问题通常是从更加小的问题转化到更加大的问题。然后是从地往上 bottom up地计算答案的。 能得出状态转移方程就好办了,本题的状态转移方程是: if (cowID[i] == cow{j]) tbl[id ...
分类:其他好文   时间:2017-05-30 22:01:28    阅读次数:152
1561条   上一页 1 ... 47 48 49 50 51 ... 157 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!