LeetCode #Palindrome Number#
又是个软柿子啊...(主要是今天不知道在哪儿看到一个回文的题目了,然后就特地去LeetCode找了一下,还真有,一次性AC的感觉简直不能再爽)
我的Python版本解答:
"""
Programmer : EOF
E-mail : jasonleaster@gmail.com...
分类:
其他好文 时间:
2015-04-07 00:46:13
阅读次数:
203
---恢复内容开始---1、解析Partiton 把map任务的输出的中间结果按照key的范围进行划分成r份,r代表reduce任务的个数。hadoop默认有个类HashPartition实现分区,通过key对reduce的个数取模(key%r),这样可以保证一段范围内的key交由一个reduce....
分类:
其他好文 时间:
2015-04-06 23:14:26
阅读次数:
332
https://leetcode.com/problems/palindrome-partitioning/Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all...
分类:
其他好文 时间:
2015-04-06 15:23:49
阅读次数:
112
void temp(int *l,int i,int j){ int t=l[i]; l[i]=l[j]; l[j]=t; }int partition(int *l,int low,int high){ int privotkey=l[low]; whi...
分类:
编程语言 时间:
2015-04-05 23:17:59
阅读次数:
211
Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
...
分类:
其他好文 时间:
2015-04-05 22:00:12
阅读次数:
127
两种方法,一个是基于快排的partition函数,但这种存在一个问题,如果数组{1,1,1,1,1,1,2,3,4,5,6},这样的话,partition返回的数字为2所对应的index 所以这种方法需要添加一个判定数组中是否存在超过一半数字的数 另外一种是,首先认为第一个数就是我们想找的,设置一个...
分类:
编程语言 时间:
2015-04-05 20:12:23
阅读次数:
162
这道题采用动态规划的思想。参考了别人的做法。class Solution{public: vector> result; vector> partition(string s) { int len = s.length(); vector soloresult; if(s.leng...
分类:
其他好文 时间:
2015-04-05 18:47:49
阅读次数:
141
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-04-05 17:20:10
阅读次数:
97
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:
其他好文 时间:
2015-04-05 15:53:15
阅读次数:
107