Given a strings, partitionssuch that every
substring of the partition is a palindrome.Return all possible palindrome
partitioning ofs.For example, giv...
分类:
其他好文 时间:
2014-07-22 23:08:15
阅读次数:
446
Given a strings1, we may represent it as a
binary tree by partitioning it to two non-empty substrings recursively.Below is
one possible representation...
分类:
其他好文 时间:
2014-05-26 11:24:36
阅读次数:
214
题意:如图已知AB,AC,BC,和SADE与SDECB的比r,求AD的长。解题思路:由于SADE/SABC=(AD/AB)^2;
令p=SADE ,q=SDECB; p/(p+q)=(AD/AB)^2; 1/(1+q/p)=(AD/AB)^2;所以AD=AB*sqrt(...
分类:
其他好文 时间:
2014-05-17 23:08:43
阅读次数:
380
题目一:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
...
分类:
其他好文 时间:
2014-05-14 15:10:01
阅读次数:
293
1、Clone Graph
Clone an undirected graph. Each node in the graph contains a label and
a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as...
分类:
其他好文 时间:
2014-05-09 02:17:58
阅读次数:
336
这道题还挺复杂的,回来看了好一会儿才想起当时怎么想的。。上道题刚说不要打表,这道题就用了打表。。
总的思路是这样的,从后面往前面打表,最后一个位置的最小分割一定是0,那往前呢,如果当前考虑的位置是start,并且substr(s, i)是回文的,那么如果已知i+1开始的分割次数,那么start这个位置的分割应该就是start原来的和i+1开始的分割次数加1之间的最小值。DP的思想,很直接。
但...
分类:
其他好文 时间:
2014-05-07 07:37:39
阅读次数:
307
方法一:DFS递归,判断每一个是否为回文数1,首先要有一个判断字符串是否是回文的函数。容易实现,字符串从两边同时往中间走,看字符是否相同;2,深度优先搜索思想对字符串进行遍历。得到结果。例如,s
= "abacd"; 需要对“a”“ad”“aba”“abac”“abacd”进行深度优先搜索。深度搜索...
分类:
其他好文 时间:
2014-05-06 00:52:34
阅读次数:
388
Given a strings, partitionssuch that every
substring of the partition is a palindrome.Return the minimum cuts needed for a
palindrome partitioning ofs...
分类:
其他好文 时间:
2014-05-01 14:47:09
阅读次数:
409